Class: Sunniesnow::Charter::CLI::Subcommand
- Inherits:
-
Object
- Object
- Sunniesnow::Charter::CLI::Subcommand
- Defined in:
- lib/sscharter/cli.rb
Instance Method Summary collapse
-
#initialize(name, option_parser, &block) ⇒ Subcommand
constructor
A new instance of Subcommand.
- #run ⇒ Object
Constructor Details
#initialize(name, option_parser, &block) ⇒ Subcommand
Returns a new instance of Subcommand.
37 38 39 40 41 42 |
# File 'lib/sscharter/cli.rb', line 37 def initialize name, option_parser, &block @name = name @option_parser = option_parser @block = block CLI.commands[name] = self end |
Instance Method Details
#run ⇒ Object
44 45 46 47 48 |
# File 'lib/sscharter/cli.rb', line 44 def run = {} @option_parser.parse! into: @block.(*ARGV, **) end |