tools/site_compare/command_line.py
def AddArgument(self, names, helptext, type="string", metaname=None,
                  required=False, default=None, positional=False):
    """Command-line argument to a command.

    Args:
      names:      argument name, or list of synonyms
      helptext:   brief description of the argument
      type:       type of the argument
      metaname:   Name to display for value in help, inferred if not
      required:   True if argument must be specified
      default:    Default value if not specified
      positional: Argument specified by location, not name

    Raises:
      ValueError: the argument already exists or is invalid

    Returns:
      The newly-created argument
    """
    if IsString(names): names = [names]

    names = [name.lower() for name in names]

    for name in names:
      if name in self.arg_dict:
        raise ValueError("%s is already an argument"%name)

    if (positional and required and
        [arg for arg in self.args if arg.positional] and
        not [arg for arg in self.args if arg.positional][-1].required):
      raise ValueError(
        "A required positional argument may not follow an optional one.")

    arg = Command.Argument(names, helptext, type, metaname,
                           required, default, positional)

    self.args.append(arg)

    for name in names:
      self.arg_dict[name] = arg

    return arg
Command-line argument to a command.

    Args:
      names:      argument name, or list of synonyms
      helptext:   brief description of the argument
      type:       type of the argument
      metaname:   Name to display for value in help, inferred if not
      required:   True if argument must be specified
      default:    Default value if not specified
      positional: Argument specified by location, not name

    Raises:
      ValueError: the argument already exists or is invalid

    Returns:
      The newly-created argument
    
Command-line argument to a command.
Command - line argument to a command .
def AddArgument(self, names, helptext, type="string", metaname=None,
                  required=False, default=None, positional=False):
    if IsString(names): names = [names]
    names = [name.lower() for name in names]
    for name in names:
      if name in self.arg_dict:
        raise ValueError("%s is already an argument"%name)
    if (positional and required and
        [arg for arg in self.args if arg.positional] and
        not [arg for arg in self.args if arg.positional][-1].required):
      raise ValueError(
        "A required positional argument may not follow an optional one.")
    arg = Command.Argument(names, helptext, type, metaname,
                           required, default, positional)
    self.args.append(arg)
    for name in names:
      self.arg_dict[name] = arg
    return arg
def AddArgument ( self , names , helptext , type = "string" , metaname = None , required = False , default = None , positional = False ) : if IsString ( names ) : names = [ names ] names = [ name . lower ( ) for name in names ] for name in names : if name in self . arg_dict : raise ValueError ( "%s is already an argument" % name ) if ( positional and required and [ arg for arg in self . args if arg . positional ] and not [ arg for arg in self . args if arg . positional ] [ - 1 ] . required ) : raise ValueError ( "A required positional argument may not follow an optional one." ) arg = Command . Argument ( names , helptext , type , metaname , required , default , positional ) self . args . append ( arg ) for name in names : self . arg_dict [ name ] = arg return arg
Command-line argument to a command.
Command - line argument to a command .
"""Command-line argument to a command.

    Args:
      names:      argument name, or list of synonyms
      helptext:   brief description of the argument
      type:       type of the argument
      metaname:   Name to display for value in help, inferred if not
      required:   True if argument must be specified
      default:    Default value if not specified
      positional: Argument specified by location, not name

    Raises:
      ValueError: the argument already exists or is invalid

    Returns:
      The newly-created argument
    """
The newly-created argument
The newly - created argument
the argument already exists or is invalid
the argument already exists or is invalid
ValueError
self
names
argument name, or list of synonyms
argument name or list of synonyms
helptext
brief description of the argument
brief description of the argument
type
type of the argument
type of the argument
metaname
Name to display for value in help, inferred if not
Name to display for value in help inferred if not
required
True if argument must be specified
True if argument must be specified
default
Default value if not specified
Default value if not specified
positional
Argument specified by location, not name
Argument specified by location not name