class GLI::GLIOptionParser
Parses the command-line options using an actual OptionParser
Constants
- DEFAULT_OPTIONS
Attributes
options[RW]
Public Class Methods
new(commands,flags,switches,accepts, options={})
click to toggle source
# File lib/gli/gli_option_parser.rb, line 13 def initialize(commands,flags,switches,accepts, options={}) self.options = DEFAULT_OPTIONS.merge(options) command_finder = CommandFinder.new(commands, :default_command => (options[:default_command] || :help), :autocomplete => options[:autocomplete]) @global_option_parser = GlobalOptionParser.new(OptionParserFactory.new(flags,switches,accepts),command_finder,flags) @accepts = accepts if options[:argument_handling_strategy] == :strict && options[:subcommand_option_handling_strategy] != :normal raise ArgumentError, "To use strict argument handling, you must enable normal subcommand_option_handling, e.g. subcommand_option_handling :normal" end end