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



84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/dri/cli.rb', line 84

def faq(*)
  if options[:help]
    invoke :help, ['faq']
  else
    begin
      require_relative 'commands/faq'
      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



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

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

#initObject



71
72
73
74
75
76
77
78
# File 'lib/dri/cli.rb', line 71

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

#profileObject



59
60
61
62
63
64
65
66
# File 'lib/dri/cli.rb', line 59

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

#versionObject



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

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