Class: RunKit::Options::Main
- Inherits:
-
Object
- Object
- RunKit::Options::Main
- Defined in:
- lib/run_kit/options/main.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #app_name ⇒ Object
-
#initialize ⇒ Main
constructor
A new instance of Main.
-
#parse(argv) ⇒ Object
Parse argv and turn internal parser outcomes into CLI behavior.
Constructor Details
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
24 25 26 |
# File 'lib/run_kit/options/main.rb', line 24 def config @config end |
Instance Method Details
#app_name ⇒ Object
27 |
# File 'lib/run_kit/options/main.rb', line 27 def app_name = config.app_name |
#parse(argv) ⇒ Object
Parse argv and turn internal parser outcomes into CLI behavior.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/run_kit/options/main.rb', line 30 def parse(argv) config.prepare! begin = Parser.new(config).parse(argv) klass = Data.define(*.keys) klass.new(**) rescue Error => ex warn "#{app_name}: #{ex.}" warn "#{app_name}: try '#{app_name} --help' for more information" exit_fn(1, error: ex.) rescue HelpRequested, NakedRequested, VersionRequested => ex early_exit(ex) exit_fn(0) end end |