Skip to content

Instantly share code, notes, and snippets.

@sai92messy
Last active May 13, 2017 09:59
Show Gist options
  • Save sai92messy/40f1cd6ca1bd1d1c70871dfcde446499 to your computer and use it in GitHub Desktop.
Save sai92messy/40f1cd6ca1bd1d1c70871dfcde446499 to your computer and use it in GitHub Desktop.
Mina-0.3.4 ssh helpers
# /mina-0.3.4/lib/mina/ssh_helpers.rb
# ### ssh_command
# Returns the SSH command to be executed.
#
# set :domain, 'foo.com'
# set :user, 'diggity'
#
# puts ssh_command
# #=> 'ssh diggity@foo.com'
def ssh_command
args = domain!.dup
args = "#{user}@#{args}" if user?
args << " -i #{identity_file}" if identity_file?
args << " -p #{port}" if port?
args << " -A" if forward_agent?
args << " #{ssh_options}" if ssh_options?
args << " -t"
"ssh #{args}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment