Method: Chore::CLI.register_option
- Defined in:
- lib/chore/cli.rb
.register_option(key, *args, &blk) ⇒ Object
register_option is a method for plugins or other components to register command-line config options.
-
keyis the name for this option that can be referenced from Chore.config.key -
*argsis anOptionParserstyle list of options. -
&blkis an option block, passed toOptionParser
Examples
Chore::CLI.register_option 'sample', '-s', '--sample-key SOME_VAL', 'A description of this value'
Chore::CLI.register_option 'something', '-g', '--something-complex VALUE', 'A description' do |arg|
# make sure your key here matches the key you register
options[:something] arg.split(',')
end
40 41 42 |
# File 'lib/chore/cli.rb', line 40 def self.register_option(key,*args,&blk) instance.register_option(key,*args,&blk) end |