Module: Drakkon::Gems::CLI
- Defined in:
- lib/drakkon/gem/cli.rb
Overview
Run Command for CLI
Class Method Summary collapse
- .args(raw = []) ⇒ Object
-
.init!(raw) ⇒ Object
General Run.
- .menu ⇒ Object
- .prompt ⇒ Object
- .start(cmd) ⇒ Object
Class Method Details
.args(raw = []) ⇒ Object
5 6 7 8 9 |
# File 'lib/drakkon/gem/cli.rb', line 5 def self.args(raw = []) @args ||= raw @args end |
.init!(raw) ⇒ Object
General Run
12 13 14 15 16 17 18 19 |
# File 'lib/drakkon/gem/cli.rb', line 12 def self.init!(raw) Settings.ready? args(raw) cmd = args.shift start(cmd&.to_sym) end |
.menu ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/drakkon/gem/cli.rb', line 35 def self. prompt.select('Wat do?', filter: true) do || .choice name: 'install (New Gem)', value: :install .choice name: 'configure', value: :configure unless Settings.gems.empty? end rescue TTY::Reader::InputInterrupt exit 0 end |
.prompt ⇒ Object
31 32 33 |
# File 'lib/drakkon/gem/cli.rb', line 31 def self.prompt TTY::Prompt.new(active_color: :cyan, interrupt: :exit) end |