diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/leap_cli/commands/run.rb | 13 | ||||
-rw-r--r-- | lib/leap_cli/commands/vagrant.rb | 2 |
2 files changed, 9 insertions, 6 deletions
diff --git a/lib/leap_cli/commands/run.rb b/lib/leap_cli/commands/run.rb index 52121035..a12af60e 100644 --- a/lib/leap_cli/commands/run.rb +++ b/lib/leap_cli/commands/run.rb @@ -1,9 +1,10 @@ module LeapCli; module Commands - desc 'runs the specified command on each node.' - arg_name 'FILTER' + desc 'Run a shell command remotely' + long_desc "Runs the specified command COMMAND on each node in the FILTER set. " + + "For example, `leap run 'uname -a' webapp`" + arg_name 'COMMAND FILTER' command :run do |c| - c.flag 'cmd', :arg_name => 'COMMAND', :desc => 'The command to run.' c.switch 'stream', :default => false, :desc => 'If set, stream the output as it arrives. (default: --no-stream)' c.flag 'port', :arg_name => 'SSH_PORT', :desc => 'Override default SSH port used when trying to connect to the server.' c.action do |global, options, args| @@ -15,8 +16,10 @@ module LeapCli; module Commands def run_shell_command(global, options, args) require 'leap_cli/ssh' - cmd = global[:force] ? options[:cmd] : LeapCli::SSH::Options.sanitize_command(options[:cmd]) - nodes = manager.filter!(args) + cmd = args[0] + filter = args[1..-1] + cmd = global[:force] ? cmd : LeapCli::SSH::Options.sanitize_command(cmd) + nodes = manager.filter!(filter) if options[:stream] stream_command(nodes, cmd, options) else diff --git a/lib/leap_cli/commands/vagrant.rb b/lib/leap_cli/commands/vagrant.rb index 8d66a84a..b0ae1cf8 100644 --- a/lib/leap_cli/commands/vagrant.rb +++ b/lib/leap_cli/commands/vagrant.rb @@ -4,7 +4,7 @@ require 'fileutils' module LeapCli; module Commands desc "Manage local virtual machines." - long_desc "This command provides a convient way to manage Vagrant-based virtual machines. If FILTER argument is missing, the command runs on all local virtual machines. The Vagrantfile is automatically generated in 'test/Vagrantfile'. If you want to run vagrant commands manually, cd to 'test'." + long_desc "This command provides a convenient way to manage Vagrant-based virtual machines. If FILTER argument is missing, the command runs on all local virtual machines. The Vagrantfile is automatically generated in 'test/Vagrantfile'. If you want to run vagrant commands manually, cd to 'test'." command [:local, :l] do |local| local.desc 'Starts up the virtual machine(s)' local.arg_name 'FILTER', :optional => true #, :multiple => false |