Class: GLI::GLIOptionParser::LegacyCommandOptionParser

Inherits:
NormalCommandOptionParser show all
Defined in:
lib/gli/gli_option_parser.rb

Instance Attribute Summary

Attributes inherited from NormalCommandOptionParser

#cli_options

Instance Method Summary collapse

Methods inherited from NormalCommandOptionParser

#error_handler, #initialize

Constructor Details

This class inherits a constructor from GLI::GLIOptionParser::NormalCommandOptionParser

Instance Method Details

#parse!(parsing_result) ⇒ Object



114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/gli/gli_option_parser.rb', line 114

def parse!(parsing_result)
  command                     = parsing_result.command
  option_parser_factory       = OptionParserFactory.for_command(command,@accepts)
  option_block_parser         = LegacyCommandOptionBlockParser.new(option_parser_factory, self.error_handler)
  option_block_parser.command = command

  parsing_result.arguments       = option_block_parser.parse!(parsing_result.arguments)
  parsing_result.cli_options["commands"][command.name] = option_parser_factory.options_hash.dup
  parsing_result.command_options = option_parser_factory.options_hash_with_defaults_set!

  subcommand,args                = find_subcommand(command,parsing_result.arguments)
  parsing_result.command         = subcommand
  parsing_result.arguments       = args
end