Class: Dri::CLI
- Inherits:
-
Thor
- Object
- Thor
- Dri::CLI
- 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
- #faq ⇒ Object
- #help(*args) ⇒ Object
- #incidents ⇒ Object
- #init ⇒ Object
- #profile ⇒ Object
- #version ⇒ Object
Class Method Details
.exit_on_failure? ⇒ Boolean
16 17 18 |
# File 'lib/dri/cli.rb', line 16 def self.exit_on_failure? true end |
Instance Method Details
#faq ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/dri/cli.rb', line 79 def faq(*) if [:help] invoke :help, ['faq'] else begin Dri::Commands::FAQ.new().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: ![:no_color]) puts pastel.yellow(font.write("DRI")) super end |
#incidents ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/dri/cli.rb', line 39 def incidents(*) if [:help] invoke :help, ['incidents'] else Dri::Commands::Incidents.new().execute end end |
#init ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/dri/cli.rb', line 67 def init(*) if [:help] invoke :help, ['init'] else Dri::Commands::Init.new().execute end end |
#profile ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/dri/cli.rb', line 56 def profile(*) if [:help] invoke :help, ['profile'] else Dri::Commands::Profile.new().execute end end |
#version ⇒ Object
31 32 33 |
# File 'lib/dri/cli.rb', line 31 def version puts "v#{Dri::VERSION}" end |