git => $args{git},
);
return unless defined $config;
+ my $command = App::Rgit::Command->new(
+ cmd => $args{cmd},
+ args => $args{args},
+ );
+ return unless defined $command;
$class->SUPER::new(
config => $config,
- command => App::Rgit::Command->new(
- cmd => $args{cmd},
- args => $args{args},
- repos => $config->repos,
- )
+ command => $command,
);
}
use Carp qw/croak/;
-use Object::Tiny qw/cmd cwd_as_repo args repos/;
+use Object::Tiny qw/cmd cwd_as_repo args/;
use App::Rgit::Utils qw/validate/;
use App::Rgit::Repository;
=head1 METHODS
-=head2 C<< new cmd => $cmd, args => \@args, repos => \@repos >>
+=head2 C<< new cmd => $cmd, args => \@args >>
-Creates a new command object for C<$cmd> that will called for all repositories C<@repos> with arguments C<@args>.
+Creates a new command object for C<$cmd> that is bound to be called with arguments C<@args>.
=cut
$class->SUPER::new(
cmd => $cmd,
args => $args{args} || [ ],
- repos => $args{repos},
cwd_as_repo => $r,
);
}
=head2 C<args>
-=head2 C<repos>
-
Accessors.
=head2 C<run $conf>
sub run {
my $self = shift;
+ my $conf = shift;
my $status = 0;
- for (@{$self->repos}) {
+ for (@{$conf->repos}) {
$_->chdir or next;
- $status = $_->run($_[0], @{$self->args});
+ $status = $_->run($conf, @{$self->args});
last if $status;
}
$self->cwd_as_repo->chdir;