summaryrefslogtreecommitdiff
path: root/lib/leap_cli/commands/run.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2016-08-19 12:19:54 -0700
committerelijah <elijah@riseup.net>2016-08-19 12:19:54 -0700
commit92ab2ec1fecb62078dfc8200cffb2440f2c6b300 (patch)
tree315b43850572c29ed6e2dfd92bba6ab94c75c5f5 /lib/leap_cli/commands/run.rb
parentd560765bb9ad6c4fe562e5742cb9f5bf388f86d1 (diff)
leap_cli: better arguments to 'leap run'
Diffstat (limited to 'lib/leap_cli/commands/run.rb')
-rw-r--r--lib/leap_cli/commands/run.rb13
1 files changed, 8 insertions, 5 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