Class: ShellOpts::Grammar::Program
- Defined in:
- lib/shellopts/parser.rb,
lib/shellopts/grammar.rb,
lib/shellopts/formatter.rb
Constant Summary
Constants inherited from Command
Command::COMMANDS_ABBR, Command::DESCRS_ABBR, Command::OPTIONS_ABBR
Constants inherited from Node
Instance Attribute Summary collapse
-
#info ⇒ Object
readonly
Lifted from .gemspec.
Attributes inherited from Command
#brief, #commands, #description, #descrs, #option_groups, #options, #specs, #supercommand
Attributes inherited from IdrNode
#attr, #command, #ident, #name, #path, #uid
Attributes inherited from Node
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Command
#[], #collect_options, command, #compute_command_hashes, #compute_option_hashes, #dump_idr, #dump_structure, #initialize, #key?, #keys, #names, #parse, #puts_brief, #puts_descr, #puts_help, #puts_usage, #render, #render_structure, #reorder_options, #set_supercommand
Methods inherited from IdrNode
Methods inherited from Node
#analyzer_error, #ancestors, #dump_ast, #dump_attrs, #dump_idr, #initialize, #inspect, #parents, #parse, #parser_error, #puts_help, #puts_usage, #remove_arg_descr_nodes, #remove_arg_spec_nodes, #remove_brief_nodes, #traverse
Constructor Details
This class inherits a constructor from ShellOpts::Grammar::Command
Instance Attribute Details
#info ⇒ Object (readonly)
Lifted from .gemspec. TODO
286 287 288 |
# File 'lib/shellopts/grammar.rb', line 286 def info @info end |
Class Method Details
.parse(token) ⇒ Object
122 123 124 |
# File 'lib/shellopts/parser.rb', line 122 def self.parse(token) super(nil, token) end |
Instance Method Details
#add_stdopts ⇒ Object
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/shellopts/parser.rb', line 126 def add_stdopts option_token = Token.new(:option, 1, 1, "--version") brief_token = Token.new(:brief, 1, 1, "Write version number and exit") group = OptionGroup.new(self, option_token) option = Option.parse(group, option_token) brief = Brief.parse(group, brief_token) option_token = Token.new(:option, 1, 1, "-h,help") brief_token = Token.new(:brief, 1, 1, "Write help text and exit") paragraph_token = Token.new(:text, 1, 1, "-h prints a brief help text, --help prints a longer man-style description of the command") group = OptionGroup.new(self, option_token) option = Option.parse(group, option_token) brief = Brief.parse(group, brief_token) paragraph = Paragraph.parse(group, paragraph_token) end |