| Class | Slop::Commands |
| In: |
lib/slop/commands.rb
|
| Parent: | Object |
| arguments | [R] | |
| banner | [W] | |
| commands | [R] | |
| config | [R] |
Create a new instance of Slop::Commands and optionally build Slop instances via a block. Any configuration options used in this method will be the default configuration options sent to each Slop object created.
config - An optional configuration Hash. block - Optional block used to define commands.
Examples:
commands = Slop::Commands.new do
on :new do
on '-o', '--outdir=', 'The output directory'
on '-v', '--verbose', 'Enable verbose mode'
end
on :generate do
on '--assets', 'Generate assets', :default => true
end
global do
on '-D', '--debug', 'Enable debug mode', :default => false
end
end
commands[:new].class #=> Slop
commands.parse
Parse a list of items, removing any options or option arguments found.
items - The Array of items to parse.
Returns the original Array of items with options removed.