Module: Ursa::Packages::ITerm
- Includes:
- SystemEvents
- Defined in:
- lib/ursa/packages/iterm.rb
Instance Method Summary collapse
- #execute(*commands) ⇒ Object
- #run(*words) ⇒ Object
- #run_in_current_session ⇒ Object
- #split_horizontal ⇒ Object
- #split_vertical ⇒ Object
Methods included from SystemEvents
Instance Method Details
#execute(*commands) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/ursa/packages/iterm.rb', line 5 def execute(*commands) run_in_current_session do commands.each do |command| raw "write text \"#{command}\"" end end end |
#run(*words) ⇒ Object
13 14 15 |
# File 'lib/ursa/packages/iterm.rb', line 13 def run(*words) execute words.map(&:to_s).join(' ') end |
#run_in_current_session ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/ursa/packages/iterm.rb', line 25 def run_in_current_session tell app('iTerm') do tell 'the current terminal' do raw "activate current session" tell('the last session') { yield } end end end |
#split_horizontal ⇒ Object
21 22 23 |
# File 'lib/ursa/packages/iterm.rb', line 21 def split_horizontal press_keys { command + d } end |
#split_vertical ⇒ Object
17 18 19 |
# File 'lib/ursa/packages/iterm.rb', line 17 def split_vertical press_keys { command + shift + d } end |