sub _run_each {
my ($self, $cmd, $code, @argv) = @_;
my @targets = $self->_host_list_for($cmd);
- unless (@targets) {
+ unless (@targets or $self->options->{local}) {
$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) {
+ unless (@targets or $self->options->{local}) {
$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);
}