diff --git a/lib/tugboat/cli.rb b/lib/tugboat/cli.rb index b69fbb7..0f7fc0b 100644 --- a/lib/tugboat/cli.rb +++ b/lib/tugboat/cli.rb @@ -83,6 +83,10 @@ def images :type => :string, :aliases => "-o", :desc => "Custom SSH options" + method_option "ssh_command", + :type => :string, + :aliases => "-c", + :desc => "Command to run on the droplet" def ssh(name=nil) Middleware.sequence_ssh_droplet.call({ "user_droplet_id" => options[:id], @@ -90,7 +94,8 @@ def ssh(name=nil) "user_droplet_fuzzy_name" => name, "user_droplet_ssh_port" => options[:ssh_port], "user_droplet_ssh_user" => options[:ssh_user], - "user_droplet_ssh_opts" => options[:ssh_opts] + "user_droplet_ssh_opts" => options[:ssh_opts], + "user_droplet_ssh_command" => options[:ssh_command] }) end diff --git a/lib/tugboat/middleware/ssh_droplet.rb b/lib/tugboat/middleware/ssh_droplet.rb index d3ebdab..b81aada 100644 --- a/lib/tugboat/middleware/ssh_droplet.rb +++ b/lib/tugboat/middleware/ssh_droplet.rb @@ -28,6 +28,9 @@ def call(env) options << host_string + if env["user_droplet_ssh_command"] + options.push(env["user_droplet_ssh_command"]) + end Kernel.exec("ssh", *options)