Class: Mortar::CLI

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

Overview

workaround for rescue/reraise to define errors in command.rb failing in 1.8.6 if RUBY_VERSION =~ /^1.8.6/

require('mortar-api')
require('rest_client')

end

Defined Under Namespace

Modules: Errors

Class Method Summary collapse

Methods included from Helpers

action, ask, confirm, copy_if_not_present_at_dest, default_host, deprecate, display, display_header, display_object, display_row, display_table, display_with_indent, download_to_file, ensure_dir_exists, error, error_with_failure, error_with_failure=, extended, extended_into, format_bytes, format_date, format_with_bang, full_host, get_terminal_environment, home_directory, host, hprint, hputs, included, included_into, installed_with_omnibus?, json_decode, json_encode, line_formatter, longest, output_with_bang, pending_github_team_state_message, quantify, redisplay, retry_on_exception, running_on_a_mac?, running_on_windows?, set_buffer, shell, spinner, status, string_distance, styled_array, styled_error, styled_hash, styled_header, suggestion, test_name, ticking, time_ago, truncate, warning, with_tty, write_to_file

Class Method Details

.start(*args) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/mortar/cli.rb', line 34

def self.start(*args)
  begin
    if $stdin.isatty
      $stdin.sync = true
    end
    if $stdout.isatty
      $stdout.sync = true
    end
    command = args.shift.strip rescue "help"
    Mortar::Command.load
    Mortar::Command.run(command, args)
  rescue Interrupt
    `stty icanon echo`
    error("Command cancelled.")
  rescue => error
    styled_error(error)
    exit(1)
  end
end