Class: Tweemux::Action::On
- Inherits:
-
Tweemux::Action
- Object
- Tweemux::Action
- Tweemux::Action::On
- Defined in:
- lib/tweemux/action/on.rb
Direct Known Subclasses
Instance Method Summary collapse
Methods inherited from Tweemux::Action
#call, colorize_tmux_command, explain, #explained_run, explained_run, #explained_run_as, explained_run_as, highlight_command, highlight_explanation, #initialize, load_all!, pseudo_restarts, system_or_raise, tmux_S, #tmux_S
Constructor Details
This class inherits a constructor from Tweemux::Action
Instance Method Details
#run(args) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/tweemux/action/on.rb', line 2 def run args host, port, *rest = args cmd = 'ssh', host if port cmd.push '-p'+port port_parens = " (on port #{port})" end desc = ["Connect to #{host}#{port_parens}"] forced_path_for_osx_people = 'PATH=/usr/local/bin:/usr/bin' cmd.concat [ '-t', forced_path_for_osx_people ] desc.push 'demand a pty' cmd.concat [ 'tmux', '-2uS', Tweemux::SOCK ] desc.push 'Run tmux (with 256 colors, UTF-8, on the shared socket' if rest.empty? cmd.push 'attach' desc.push 'attach to existing session' else cmd.concat rest desc.push rest.join ' ' end description = desc.join ', ' explained_run cmd, description end |