Module: Ec2Ssh::Cli::Utils

Defined in:
lib/ec2-ssh/utils.rb

Instance Method Summary collapse

Instance Method Details

#open_in_terminalObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ec2-ssh/utils.rb', line 2

def open_in_terminal
  @all_servers.each do |server|
    say "Opening #{server} in a new tab", color = :cyan
    `osascript <<-eof
       tell application "iTerm"
        make new terminal
        tell the current terminal
          activate current session
          launch session "Default Session"
          tell the last session
            set name to "#{server}"
            write text "ssh ec2-user@#{server}"
          end tell
        end tell
       end tell
    eof`
  end
end