Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`python`.`usage`.`Completions``

class documentation

`class Completions: (source)`

Constructor: `Completions(descriptions, multiUse, mutuallyExclusive, optActions, extraActions)`

View In Hierarchy

Extra metadata for the shell tab-completion system.

Method | `__init__` | Undocumented
Instance Variable | `descriptions` | ex. `{"foo" : "use this description for foo instead"}` 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 | `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 | `multiUse` | ex. `["foo", "bar"]` 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` | ex. `[("foo", "bar"), ("bar", "baz")]` 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. By default, all files/dirs will be completed if no action is given. ...

def __init__(self, descriptions={}, multiUse=[], mutuallyExclusive=[], optActions={}, extraActions=[]): (source)

Undocumented

descriptions: `dict` = (source)

ex. `{"foo" : "use this description for foo instead"}` 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.

extraActions: `list` = (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. For example:

        [CompleteFiles(descr="file to read from"),
         Completer(descr="book title")]

In the example above, the 1st non-option argument will be described as "file to read from" and all file/dir names will be completed (*). The 2nd non-option argument will be described as "book title", but no actual completion matches will be produced.

See the various `Completer` subclasses for other types of things which may be tab-completed (users, groups, network interfaces, etc).

Also note the `repeat=True` flag which may be passed to any of the `Completer` classes. This is set to allow the `Completer` instance to be re-used for subsequent command-line words. See the `Completer` docstring for details.

multiUse: `list` = (source)

ex. `["foo", "bar"]` 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)

ex. `[("foo", "bar"), ("bar", "baz")]` 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. By default, all files/dirs will be completed if no action is given. For example:

        {"foo"    : CompleteFiles("*.py", descr="python files"),
         "bar"    : CompleteList(["one", "two", "three"]),
         "colors" : CompleteMultiList(["red", "green", "blue"])}

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 in the same way as the literal actions in the example above.

As you can see in the example above. The "foo" option will have files that end in .py completed when the user presses Tab. The "bar" option will have either of the strings "one", "two", or "three" completed when the user presses Tab.

"colors" will allow multiple arguments to be completed, separated by commas. The possible arguments are red, green, and blue. Examples:

        my_command --foo some-file.foo --colors=red,green
        my_command --colors=green
        my_command --colors=green,blue

Descriptions for the actions may be given with the optional `descr` keyword argument. This is separate from the description of the option itself.

Normally Zsh does not show these descriptions unless you have "verbose" completion turned on. Turn on verbosity with this in your ~/.zshrc:

        zstyle ':completion:*' verbose yes
        zstyle ':completion:*:descriptions' format '%B%d%b'