Parent

Clio::Usage::Parser

Parser

Parse commandline arguments according to given Usage.

Attributes

argv[R]
signatures[R]
usage[R]

Public Class Methods

new(usage, argv) click to toggle source
# File lib/clio/usage/parser.rb, line 20
def initialize(usage, argv) #, index=0)
  # convert to array if argv string
  if ::String===argv
    argv = Shellwords.shellwords(argv)
  else
    argv = argv.dup
  end

  @usage  = usage
  @argv   = argv

  @parsed     = false
  @signatures = []
  @errors     = []
end

Public Instance Methods

errors() click to toggle source
# File lib/clio/usage/parser.rb, line 175
def errors
  @errors
end
Also aliased as: parse_errors
inspect() click to toggle source
# File lib/clio/usage/parser.rb, line 41
def inspect
  s = "<" + signatures.inspect + ">"
  s
  #s  = "#<#{self.class}"
  #s << " @options=#{@options.inspect}" unless @options.empty?
  #s << " @arguments=#{@arguments.inspect}" unless @arguments.empty?
  #s << " @subcommand=#{@subcommand}>" if @subcommand
  #s << ">"
  #s
end
key() click to toggle source
# File lib/clio/usage/parser.rb, line 38
def key  ; usage.key  ; end
name() click to toggle source
# File lib/clio/usage/parser.rb, line 37
def name ; usage.name ; end
parse() click to toggle source
# File lib/clio/usage/parser.rb, line 53
def parse
  @parsed     = false
  @signatures = []
  @errors     = []

  parse_command(usage, argv.dup)

  @parsed     = true

  return Interface.new(@signatures, @errors)
end
parse_errors() click to toggle source
Alias for: errors
parsed?() click to toggle source

Has the commandline been parsed?

# File lib/clio/usage/parser.rb, line 66
def parsed? ; @parsed ; end

[Validate]

Generated with the Darkfish Rdoc Generator 2.