Class: Pebbles::CLI

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

Class Method Summary collapse

Methods included from Helpers

action, ask, confirm_command, create_git_remote, debug, debugging?, display, error, error_with_failure, error_with_failure=, flatten_hash, format_bytes, format_error, format_with_bang, git, has_git?, has_git_remote?, has_http_git_entry_in_netrc, home_directory, hputs, json_decode, launchy, line_formatter, longest, output_with_bang, running_on_a_mac?, running_on_windows?, styled_array, styled_error, styled_hash, styled_header, update_git_remote, with_tty

Class Method Details

.start(*args) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/pebbles/cli.rb', line 10

def self.start(*args)
  $stdin.sync = true if $stdin.isatty
  $stdout.sync = true if $stdout.isatty
  Pebbles::Git.check_git_version
  command = args.shift.strip rescue "help"
  Pebbles::Command.load
  Pebbles::Command.run(command, args)
rescue Errno::EPIPE => e
  error(e.message)
rescue Interrupt => e
  `stty icanon echo`
  if ENV["PEBBLES_DEBUG"]
    styled_error(e)
  else
    error("Command cancelled.", false)
  end
rescue => error
  if ENV["PEBBLES_DEBUG"]
    raise
  else
    styled_error(error)
  end
  exit(1)
end