Generate a call to the zsh _arguments completion function
based on data in a usage.Options instance

@type options: L{twisted.python.usage.Options}
@ivar options: The L{twisted.python.usage.Options} instance to generate for

@type cmdName: C{str}
@ivar cmdName: The name of the command we're generating completions for.

@type file: C{file}
@ivar file: The C{file} to write the completion function to.  The C{file}
    must have L{bytes} I/O semantics.

The following non-constructor variables are populated by this class
with data gathered from the C{Options} instance passed in, and its
base classes.

@type descriptions: C{dict}
@ivar descriptions: A dict mapping long option names to alternate
    descriptions. When this variable is defined, the descriptions
    contained here will override those descriptions provided in the
    optFlags and optParameters variables.

@type multiUse: C{list}
@ivar multiUse: An iterable containing those long option names which may
    appear on the command line more than once. By default, options will
    only be completed one time.

@type mutuallyExclusive: C{list} of C{tuple}
@ivar mutuallyExclusive: A sequence of sequences, with each sub-sequence
    containing those long option names that are mutually exclusive. That is,
    those options that cannot appear on the command line together.

@type optActions: C{dict}
@ivar optActions: A dict mapping long option names to shell "actions".
    These actions define what may be completed as the argument to the
    given option, and should be given as instances of
    L{twisted.python.usage.Completer}.

    Callables may instead be given for the values in this dict. The
    callable should accept no arguments, and return a C{Completer}
    instance used as the action.

@type extraActions: C{list} of C{twisted.python.usage.Completer}
@ivar extraActions: Extra arguments are those arguments typically
    appearing at the end of the command-line, which are not associated
    with any particular named option. That is, the arguments that are
    given to the parseArgs() method of your usage.Options subclass.
Method __init__ Undocumented
Method write Write the zsh completion code to the file given to __init__ @return: None
Method writeHeader This is the start of the code that calls _arguments @return: None
Method writeOptions Write out zsh code for each option in this command @return: None
Method writeExtras No summary
Method writeFooter Write the last bit of code that finishes the call to _arguments @return: None
Method verifyZshNames Ensure that none of the option names given in the metadata are typoed @return: None @raise ValueError: Raised if unknown option names have been found.
Method excludeStr Generate an "exclusion string" for the given option
Method makeExcludesDict
Method writeOpt Write out the zsh code for the given argument. This is just part of the one big call to _arguments
Method getAction Return a zsh "action" string for the given argument @return: str
Method getDescription Return the description to be used for this argument @return: str
Method getShortOption Return the short option letter or None @return: str or None
Method addAdditionalOptions Add additional options to the optFlags and optParams lists. These will be defined by 'opt_foo' methods of the Options subclass @return: None
def __init__(self, options, cmdName, file): (source)
Undocumented
def write(self): (source)

Write the zsh completion code to the file given to __init__

ReturnsNone
def writeHeader(self): (source)

This is the start of the code that calls _arguments

ReturnsNone
def writeOptions(self): (source)

Write out zsh code for each option in this command

ReturnsNone
def writeExtras(self): (source)

Write out completion information for extra arguments appearing on the command-line. These are extra positional arguments not associated with a named option. That is, the stuff that gets passed to Options.parseArgs().

ReturnsNone
RaisesValueError: if Completer with repeat=True is found and is not the last item in the extraActions list.
def writeFooter(self): (source)

Write the last bit of code that finishes the call to _arguments

ReturnsNone
def verifyZshNames(self): (source)

Ensure that none of the option names given in the metadata are typoed

ReturnsNone
RaisesValueErrorRaised if unknown option names have been found.
def excludeStr(self, longname, buildShort=False): (source)

Generate an "exclusion string" for the given option

ParameterslongnameThe long option name (e.g. "verbose" instead of "v") (type: str)
buildShortMay be True to indicate we're building an excludes string for the short option that corresponds to the given long opt. (type: bool)
ReturnsThe generated str
def makeExcludesDict(self): (source)
ReturnsA dict that maps each option name appearing in self.mutuallyExclusive to a list of those option names that is it mutually exclusive with (can't appear on the cmd line with).
def writeOpt(self, longname): (source)

Write out the zsh code for the given argument. This is just part of the one big call to _arguments

ParameterslongnameThe long option name (e.g. "verbose" instead of "v") (type: str)
ReturnsNone
def getAction(self, longname): (source)

Return a zsh "action" string for the given argument

Returnsstr
def getDescription(self, longname): (source)

Return the description to be used for this argument

Returnsstr
def getShortOption(self, longname): (source)

Return the short option letter or None

Returnsstr or None
def addAdditionalOptions(self): (source)

Add additional options to the optFlags and optParams lists. These will be defined by 'opt_foo' methods of the Options subclass

ReturnsNone
API Documentation for Twisted, generated by pydoctor at 2018-07-14 04:53:34.