class documentation

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

The first three instance variables are populated based on constructor arguments. The remaining non-constructor variables are populated by this class with data gathered from the Options instance passed in, and its base classes.

Method __init__ Undocumented
Method addAdditionalOptions Add additional options to the optFlags and optParams lists. These will be defined by 'opt_foo' methods of the Options subclass
Method excludeStr Generate an "exclusion string" for the given option
Method getAction Return a zsh "action" string for the given argument
Method getDescription Return the description to be used for this argument
Method getShortOption Return the short option letter or None
Method makeExcludesDict No summary
Method verifyZshNames Ensure that none of the option names given in the metadata are typoed
Method write Write the zsh completion code to the file given to __init__
Method writeExtras 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...
Method writeFooter Write the last bit of code that finishes the call to _arguments
Method writeHeader This is the start of the code that calls _arguments
Method writeOpt Write out the zsh code for the given argument. This is just part of the one big call to _arguments
Method writeOptions Write out zsh code for each option in this command
Instance Variable allOptionsNameToDefinition Undocumented
Instance Variable cmdName The name of the command we're generating completions for.
Instance Variable 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.
Instance Variable excludes Undocumented
Instance Variable 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...
Instance Variable file The file to write the completion function to. The file must have bytes I/O semantics.
Instance Variable flagNameToDefinition Undocumented
Instance Variable 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.
Instance Variable 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.
Instance Variable 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 twisted.python.usage.Completer.
Instance Variable optFlags Undocumented
Instance Variable options The twisted.python.usage.Options instance to generate for
Instance Variable optParams Undocumented
Instance Variable paramNameToDefinition Undocumented
def __init__(self, options, cmdName, file): (source)

Undocumented

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

Returns
None
def excludeStr(self, longname, buildShort=False): (source)

Generate an "exclusion string" for the given option

Parameters
longname:strThe long option name (e.g. "verbose" instead of "v")
buildShort:boolMay be True to indicate we're building an excludes string for the short option that corresponds to the given long opt.
Returns
The generated str
def getAction(self, longname): (source)

Return a zsh "action" string for the given argument

Returns
str
def getDescription(self, longname): (source)

Return the description to be used for this argument

Returns
str
def getShortOption(self, longname): (source)

Return the short option letter or None

Returns
str or None
def makeExcludesDict(self) -> Dict[str, Set[str]]: (source)
Returns
Dict[str, Set[str]]A dict that maps each option name appearing in self.mutuallyExclusive to a set of those option names that is it mutually exclusive with (can't appear on the cmd line with).
def verifyZshNames(self): (source)

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

Returns
None
Raises
ValueErrorIf unknown option names have been found.
def write(self): (source)

Write the zsh completion code to the file given to __init__

Returns
None
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().

Returns
None
Raises
ValueErrorIf 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

Returns
None
def writeHeader(self): (source)

This is the start of the code that calls _arguments

Returns
None
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

Parameters
longname:strThe long option name (e.g. "verbose" instead of "v")
Returns
None
def writeOptions(self): (source)

Write out zsh code for each option in this command

Returns
None
allOptionsNameToDefinition = (source)

Undocumented

cmdName: str = (source)

The name of the command we're generating completions for.

descriptions: dict = (source)

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.

excludes = (source)

Undocumented

extraActions: list of twisted.python.usage.Completer = (source)

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.

file: file = (source)

The file to write the completion function to. The file must have bytes I/O semantics.

flagNameToDefinition = (source)

Undocumented

multiUse: list = (source)

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.

mutuallyExclusive: list of tuple = (source)

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.

optActions: dict = (source)

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 twisted.python.usage.Completer.

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

optFlags = (source)

Undocumented

optParams = (source)

Undocumented

paramNameToDefinition = (source)

Undocumented