Class: Taketo::Commands::MoshCommand

Inherits:
Object
  • Object
show all
Includes:
SSHOptions
Defined in:
lib/taketo/commands/mosh_command.rb

Instance Method Summary collapse

Methods included from SSHOptions

#host, #identity_file, #port, #username

Constructor Details

#initialize(server, options = {}) ⇒ MoshCommand

Returns a new instance of MoshCommand.



7
8
9
# File 'lib/taketo/commands/mosh_command.rb', line 7

def initialize(server, options = {})
  @server = server
end

Instance Method Details

#programObject



15
16
17
# File 'lib/taketo/commands/mosh_command.rb', line 15

def program
  "MOSH_TITLE_NOPREFIX=1 mosh --no-init"
end

#remote_shell_programObject



23
24
25
# File 'lib/taketo/commands/mosh_command.rb', line 23

def remote_shell_program
  "/bin/sh -c"
end

#render(rendered_command) ⇒ Object



11
12
13
# File 'lib/taketo/commands/mosh_command.rb', line 11

def render(rendered_command)
  %Q[#{program} #{ssh_program} -- #{username}#{host} #{remote_shell_program} "#{rendered_command}"].squeeze(" ")
end

#ssh_programObject



19
20
21
# File 'lib/taketo/commands/mosh_command.rb', line 19

def ssh_program
  %Q[--ssh="ssh #{port} #{identity_file}"].squeeze(" ") if @server.port || @server.identity_file
end