Class: Mutant::CLI
- Inherits:
-
Object
- Object
- Mutant::CLI
- Includes:
- Adamantium::Flat
- Defined in:
- lib/mutant/cli.rb
Overview
Commandline parser
Constant Summary collapse
- Error =
Error failed when CLI argv is invalid
Class.new(RuntimeError)
- EXIT_FAILURE =
1
- EXIT_SUCCESS =
0
Instance Attribute Summary collapse
-
#config ⇒ Config
readonly
private
Config parsed from CLI.
Class Method Summary collapse
-
.run(arguments) ⇒ Fixnum
private
Run cli with arguments.
Instance Method Summary collapse
-
#initialize(arguments) ⇒ undefined
constructor
private
Initialize objecct.
Constructor Details
#initialize(arguments) ⇒ undefined
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize objecct
35 36 37 38 39 |
# File 'lib/mutant/cli.rb', line 35 def initialize(arguments) @config = Config::DEFAULT parse(arguments) end |
Instance Attribute Details
#config ⇒ Config (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Config parsed from CLI
46 47 48 |
# File 'lib/mutant/cli.rb', line 46 def config @config end |
Class Method Details
.run(arguments) ⇒ Fixnum
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Run cli with arguments
21 22 23 24 25 26 |
# File 'lib/mutant/cli.rb', line 21 def self.run(arguments) Runner.call(Env::Bootstrap.call(call(arguments))).success? ? EXIT_SUCCESS : EXIT_FAILURE rescue Error => exception $stderr.puts(exception.) EXIT_FAILURE end |