sub _run_each {
my ($self, $cmd, $code, @argv) = @_;
my @targets = $self->_host_list_for($cmd);
- unless (@targets or $self->options->{local}) {
+ unless (@targets) {
$self->stderr->print("No targets for ${cmd}\n");
return;
}
my $opt = $self->_maybe_parse_options($code, \@argv);
$self->local_client->ensure(connector => 'Tak::ConnectorService');
- $self->$code($self->local_client, $opt, @argv) if $self->options->{local};
foreach my $target (@targets) {
my $remote = $self->_connection_to($target);
$self->$code($remote, $opt, @argv);
sub _run_every {
my ($self, $cmd, $code, @argv) = @_;
my @targets = $self->_host_list_for($cmd);
- unless (@targets or $self->options->{local}) {
+ unless (@targets) {
$self->stderr->print("No targets for ${cmd}\n");
return;
}
my $opt = $self->_maybe_parse_options($code, \@argv);
$self->local_client->ensure(connector => 'Tak::ConnectorService');
my @remotes = map $self->_connection_to($_), @targets;
- unshift @remotes, $self->local_client if $self->options->{local};
$self->$code(\@remotes, $opt, @argv);
}
sub _host_list_for {
my ($self, $command) = @_;
my @host_spec = map split(' ', $_), @{$self->options->{host}};
+ unshift(@host_spec, '-') if $self->options->{local};
+ return @host_spec;
}
sub _connection_to {