Class: Turbot::CLI

Inherits:
Object
  • Object
show all
Extended by:
Helpers
Defined in:
lib/turbot/cli.rb

Constant Summary

Constants included from Helpers

Helpers::DEFAULT_HOST

Class Method Summary collapse

Methods included from Helpers

api, ask, ask_for_password, ask_for_password_on_windows, delete_netrc_entry, email_address_and_api_key, error, format_error, host, netrc_exists?, netrc_path, open_netrc, save_netrc_entry, styled_error, turbot_api, turbot_api_parameters

Class Method Details

.start(*args) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/turbot/cli.rb', line 4

def self.start(*args)
  begin
    $stdout.sync = true
    $stderr.sync = true

    trap 'SIGINT' do
      # Script terminated by Control-C.
      exit 130
    end

    Turbot::Command.load
    command = args.shift.strip rescue 'help'
    Turbot::Command.run(command, args)
  rescue Interrupt
    `stty icanon echo`
    error 'Command cancelled.'
  rescue => e
    styled_error(e)
    exit(1)
  end
end