Class: P4Tools::CommandOptions
- Inherits:
-
Object
- Object
- P4Tools::CommandOptions
- Defined in:
- lib/p4tools/parsers/command_options.rb
Instance Attribute Summary collapse
-
#show_help ⇒ Object
readonly
Returns the value of attribute show_help.
Instance Method Summary collapse
- #allow_empty_args ⇒ Object
- #arg(name, desc = '', options = {}) ⇒ Object
- #help(text) ⇒ Object
-
#initialize(parser) ⇒ CommandOptions
constructor
A new instance of CommandOptions.
- #set(&opts) ⇒ Object
Constructor Details
#initialize(parser) ⇒ CommandOptions
Returns a new instance of CommandOptions.
6 7 8 9 |
# File 'lib/p4tools/parsers/command_options.rb', line 6 def initialize(parser) @parser = parser @show_help = true end |
Instance Attribute Details
#show_help ⇒ Object (readonly)
Returns the value of attribute show_help.
4 5 6 |
# File 'lib/p4tools/parsers/command_options.rb', line 4 def show_help @show_help end |
Instance Method Details
#allow_empty_args ⇒ Object
23 24 25 |
# File 'lib/p4tools/parsers/command_options.rb', line 23 def allow_empty_args @show_help = false end |
#arg(name, desc = '', options = {}) ⇒ Object
19 20 21 |
# File 'lib/p4tools/parsers/command_options.rb', line 19 def arg(name, desc='', ={}) @parser.opt(name, desc, ) end |
#help(text) ⇒ Object
12 13 14 |
# File 'lib/p4tools/parsers/command_options.rb', line 12 def help(text) @parser.(text) end |
#set(&opts) ⇒ Object
27 28 29 |
# File 'lib/p4tools/parsers/command_options.rb', line 27 def set(&opts) self.instance_eval &opts end |