class Turbot::CLI

Public Class Methods

start(*args) click to toggle source
# 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