Method: Pablo#initialize

Defined in:
lib/pablo.rb

#initialize(opts = Hash.new) ⇒ Pablo

  • opts: options for Pablo

    • :command_consumes_all => true|false Forces toplevel commands (not) to consume all arguments after being applied. I’m still looking for a better name for that option, so it may be subject to change.

    • :expand => true|false|Array Turns on the automatic abbreviation expansion mechanism for

      • all parsers (true)

      • no parsers (false)

      • a specific parser (Array containing :commands and/or :options)

    • :program => String The name of the Program to be displayed by help and version.

    • :version => String The version of the Program to be displayed by version and help.

    • :usage => String The usage information of the Program to be displayed by help, e.g.

      [<command>] [<options>]
      


85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/pablo.rb', line 85

def initialize opts = Hash.new
    @opts = {
        :command_consumes_all => true,
        :expand => false
    }.merge(opts)

    check_options()

    @finalize = @colorize = @cur = nil
    @toplevel, @args, @pending = true, nil, Hash.new
    @expand, @ambiguity, @registered = Array.new, nil, Array.new
    @options, @commands, @tokens = Hash.new, Hash.new, Hash.new
end