Class: OptimistXL::SubcommandParser
Constant Summary
Constants inherited from Parser
Instance Attribute Summary collapse
-
#desc ⇒ Object
readonly
Returns the value of attribute desc.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from Parser
#ignore_invalid_options, #leftovers, #specs
Instance Method Summary collapse
- #default_banner ⇒ Object
-
#initialize(name, desc, *a, &b) ⇒ SubcommandParser
constructor
A new instance of SubcommandParser.
-
#subcommand_name ⇒ Object
alias to make referencing more obvious.
Methods inherited from Parser
#banner, #conflicts, #depends, #die, #educate, #educate_on_error, #opt, #parse, #parse_base, register, registry_getopttype, #stop_on, #stop_on_unknown, #subcmd, #subcommands, #synopsis, #usage, #version, #width, #wrap
Constructor Details
#initialize(name, desc, *a, &b) ⇒ SubcommandParser
Returns a new instance of SubcommandParser.
768 769 770 771 772 |
# File 'lib/optimist_xl.rb', line 768 def initialize(name, desc, *a, &b) super(a, &b) @name = name @desc = desc end |
Instance Attribute Details
#desc ⇒ Object (readonly)
Returns the value of attribute desc.
767 768 769 |
# File 'lib/optimist_xl.rb', line 767 def desc @desc end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
767 768 769 |
# File 'lib/optimist_xl.rb', line 767 def name @name end |
Instance Method Details
#default_banner ⇒ Object
779 780 781 782 783 784 785 786 787 |
# File 'lib/optimist_xl.rb', line 779 def () command_name = File.basename($0).gsub(/\.[^.]+$/, '') = '' << "Usage: #{command_name} #{@name} #{@usage}\n\n" if @usage << "#{@synopsis}\n\n" if @synopsis << "#{desc}\n\n" if @desc << "Options:\n" return end |
#subcommand_name ⇒ Object
alias to make referencing more obvious.
775 776 777 |
# File 'lib/optimist_xl.rb', line 775 def subcommand_name @name end |