Class: Dri::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/dri/cli.rb

Overview

Handle the application command line parsing and the dispatch to various command objects

Constant Summary collapse

Error =

Error raised by this runner

Class.new(StandardError)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/dri/cli.rb', line 16

def self.exit_on_failure?
  true
end

Instance Method Details

#faqObject



79
80
81
82
83
84
85
86
87
88
89
# File 'lib/dri/cli.rb', line 79

def faq(*)
  if options[:help]
    invoke :help, ['faq']
  else
    begin
      Dri::Commands::FAQ.new(options).execute
    rescue Dri::Commands::FAQ::ExitCommand
      puts "Exiting faq command..."
    end
  end
end

#help(*args) ⇒ Object



20
21
22
23
24
25
# File 'lib/dri/cli.rb', line 20

def help(*args)
  font = TTY::Font.new(:doom)
  pastel = Pastel.new(enabled: !options[:no_color])
  puts pastel.yellow(font.write("DRI"))
  super
end

#incidentsObject



39
40
41
42
43
44
45
# File 'lib/dri/cli.rb', line 39

def incidents(*)
  if options[:help]
    invoke :help, ['incidents']
  else
    Dri::Commands::Incidents.new(options).execute
  end
end

#initObject



67
68
69
70
71
72
73
# File 'lib/dri/cli.rb', line 67

def init(*)
  if options[:help]
    invoke :help, ['init']
  else
    Dri::Commands::Init.new(options).execute
  end
end

#profileObject



56
57
58
59
60
61
62
# File 'lib/dri/cli.rb', line 56

def profile(*)
  if options[:help]
    invoke :help, ['profile']
  else
    Dri::Commands::Profile.new(options).execute
  end
end

#versionObject



31
32
33
# File 'lib/dri/cli.rb', line 31

def version
  puts "v#{Dri::VERSION}"
end