Class: Threeman::Frontends::Iterm3

Inherits:
Threeman::Frontend show all
Defined in:
lib/threeman/frontends/iterm3.rb

Instance Attribute Summary

Attributes inherited from Threeman::Frontend

#options

Instance Method Summary collapse

Methods inherited from Threeman::Frontend

#bash_script, #initialize, #paned_command_names, #sort_commands

Constructor Details

This class inherits a constructor from Threeman::Frontend

Instance Method Details

#run_commands(commands) ⇒ Object


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/threeman/frontends/iterm3.rb', line 12

def run_commands(commands)
  iterm = Appscript.app("iTerm")
  iterm.activate
  window = open_option(iterm)

  sort_commands(commands).each_with_index do |command, index|
    current_tab = if index == 0
      window
    elsif paned_command_names.include?(command.name)
      tab = window.current_session.split_horizontally_with_same_profile
      tab.select
      window
    else
      window.create_tab_with_default_profile
    end

    run_command(current_tab.current_session, command)
  end
end