lib/clin/option_parser.rb
# Parse the argument for the command.
# @return [Hash] return the options parsed
# Options can also be accessed with #options
# ```
# # Suppose verbose and opt are defined option for the command.
# parser = OptionParser.new(command, %w(arg1 arg2 -v --opt val))
# parser.parse #=> {verbose: true, opt: 'val'}
# Get the arguments
# parser.argv # => ['arg1', 'arg2']
# ```
Parse the argument for the command.
Parse the argument for the command .
def parse
    while parse_next
    end
    @options
  end
def parse while parse_next end @options end
Parse the argument for the command.
Parse the argument for the command .
return the options parsed Options can also be accessed with #options ``` # Suppose verbose and opt are defined option for the command. parser = OptionParser.new(command, %w(arg1 arg2 -v --opt val)) parser.parse #=> {verbose: true, opt: 'val'} Get the arguments parser.argv # => ['arg1', 'arg2'] ```
return the options parsed Options can also be accessed with #options ` ` ` # Suppose verbose and opt are defined option for the command . parser = OptionParser . new ( command %w ( arg1 arg2 - v -- opt val )) parser . parse # = > { verbose : true opt : ' val ' } Get the arguments parser . argv # = > [ ' arg1 ' ' arg2 ' ] ` ` `
Hash