class Gitlab::Shell

def start

def start
  trap('INT') { quit_shell } # capture ctrl-c
  setup
  while (buffer = Readline.readline('gitlab> '))
    begin
      parse_input buffer
      @arguments.map! { |arg| symbolize_keys(yaml_load(arg)) }
      case buffer
      when nil, ''
        next
      when 'exit'
        quit_shell
      when /^\bhelp\b+/
        puts help(arguments[0]) { |out| out.gsub!(/Gitlab\./, 'gitlab> ') }
      else
        history << buffer
        data = execute command, arguments
        output_table command, arguments, data
      end
    rescue StandardError => e
      puts e.message
    end
  end
  quit_shell # save history if user presses ctrl-d
end