No public APIs are provided by this module. Internal use only.
This module implements dynamic tab-completion for any command that uses twisted.python.usage. Currently, only zsh is supported. Bash support may be added in the future.
Maintainer: Eric P. Mangold - twisted AT teratorn DOT org
In order for zsh completion to take place the shell must be able to find an appropriate "stub" file ("completion function") that invokes this code and displays the results to the user.
The stub used for Twisted commands is in the file twisted-completion.zsh, which is also included in the official Zsh distribution at Completion/Unix/Command/_twisted. Use this file as a basis for completion functions for your own commands. You should only need to change the first line to something like #compdef mycommand.
|Generate a call to the zsh _arguments completion function based on data in a usage.Options instance
|Constructs zsh code that will complete options for a given usage.Options instance, possibly including a list of subcommand names.
|Constructs zsh code that will complete options for a given usage.Options instance, and also for a single sub-command. This will only be used in the case where the user is completing options for a specific subcommand.
|Generate an appropriate description from docstring of the given object
|Shell escape the given string
|Perform shell completion.
Generate an appropriate description from docstring of the given object
Shell escape the given string
Implementation borrowed from now-deprecated commands.mkarg() in the stdlib
Perform shell completion.
A completion function (shell script) is generated for the requested shell and written to shellCompFile, typically stdout. The result is then eval'd by the shell to produce the desired completions.
twisted.python.usage.Options instance to generate completions for.
|The name of the command we're generating completions for. In the case of zsh, this is used to print an appropriate "#compdef $CMD" line at the top of the output. This is not necessary for the functionality of the system, but it helps in debugging, since the output we produce is properly formed and may be saved in a file and used as a stand-alone completion function.
|words:list of str
|The raw command-line words passed to use by the shell stub function. argv has already been stripped off.
|The file to write completion data to.