Module: Plist4r::Mixlib::CLI::ClassMethods
- Defined in:
- lib/plist4r/mixin/mixlib_cli.rb
Instance Methods
Instance Method Details
- (Object) banner(bstring = nil)
Change the banner. Defaults to:
Usage: #{0} (options)
Parameters
bstring | The string to set the banner to |
Returns
@banner | The current banner |
67 68 69 70 71 72 73 74 |
# File 'lib/plist4r/mixin/mixlib_cli.rb', line 67 def (bstring=nil) if bstring = bstring else ||= "Usage: #{$0} (options)" end end |
- (Object) option(name, args)
Add a command line option.
Parameters
name | The name of the option to add |
args | A hash of arguments for the option, specifying how it should be parsed. |
Returns
true: | Always returns true. |
32 33 34 35 36 |
# File 'lib/plist4r/mixin/mixlib_cli.rb', line 32 def option(name, args) ||= {} raise(ArgumentError, "Option name must be a symbol") unless name.kind_of?(Symbol) [name.to_sym] = args end |
- (Object) options
Get the hash of current options.
Returns
@options | The current options hash. |
42 43 44 45 |
# File 'lib/plist4r/mixin/mixlib_cli.rb', line 42 def ||= {} end |
- (Object) options=(val)
Set the current options hash
Parameters
val | The hash to set the options to |
Returns
@options | The current options hash. |
54 55 56 57 |
# File 'lib/plist4r/mixin/mixlib_cli.rb', line 54 def (val) raise(ArgumentError, "Options must recieve a hash") unless val.kind_of?(Hash) = val end |