Home | History | Annotate | Download | only in site_compare

Lines Matching defs:Argument

41       validator:   callable for custom argument validation
55 class Argument(object):
56 """Encapsulates an argument to a command."""
62 """Command-line argument to a command.
65 names: argument name, or list of synonyms
66 helptext: brief description of the argument
67 type: type of the argument. Valid values include:
76 required: True if argument must be specified
78 positional: Argument specified by location, not name
81 ValueError: the argument name is invalid for some reason
83 if type not in Command.Argument.VALID_TYPES:
92 if metaname and type not in Command.Argument.TYPES_WITH_VALUES:
97 if not metaname and type in Command.Argument.TYPES_WITH_VALUES:
113 self.present = False # has this argument been specified?
116 """Makes this argument dependent on another argument.
119 arg: name of the argument this one depends on
125 """Makes this argument invalid if another is specified.
128 arg: name of the mutually exclusive argument.
134 """Returns a brief string describing the argument's usage."""
137 if self.type in Command.Argument.TYPES_WITH_VALUES:
176 return "Argument %s '%s'%s" % (self.type, self.names[0], string)
178 # end of nested class Argument
182 """Command-line argument to a command.
185 names: argument name, or list of synonyms
186 helptext: brief description of the argument
187 type: type of the argument
189 required: True if argument must be specified
191 positional: Argument specified by location, not name
194 ValueError: the argument already exists or is invalid
197 The newly-created argument
205 raise ValueError("%s is already an argument"%name)
211 "A required positional argument may not follow an optional one.")
213 arg = Command.Argument(names, helptext, type, metaname,
224 """Return an argument from a name."""
239 """Specifies that one argument may only be present if another is.
242 dependent: the name of the dependent argument
243 depends_on: the name of the argument on which it depends
333 """Tests if an argument exists and has been specified."""
340 """Find the next argument in the command line and parse it."""
345 # First check: is this a literal argument?
348 if arg.type in Command.Argument.TYPES_WITH_VALUES:
371 # Third check: does this begin an argument?
375 self.arg_dict[key].type in Command.Argument.TYPES_WITH_VALUES and
391 # Push the retrieved argument/value onto the largs stack
397 raise ParseError("Unknown argument: '%s'" % argstr)
400 if arg.type in Command.Argument.TYPES_WITH_VALUES and value is None:
401 raise ParseError("Argument '%s' requires a value" % argstr)
460 arg1: the first argument to compare
461 arg2: the second argument to compare
617 """Checks to make sure an argument to 'help' is a valid command."""
681 test.AddArgument("pos1", "required positional argument", positional=True,
683 test.AddArgument("pos2", "optional positional argument", positional=True)
699 # dependent argument
700 test.AddArgument("--dependent", "dependent argument")
703 # other argument types
704 test.AddArgument("--file", "filename argument", type='readfile')
705 test.AddArgument("--coords", "coordinate argument", type='coords')
706 test.AddArgument("--flag", "flag argument", type='flag')
718 test.AddArgument("--int", "this argument already exists")