Home | Trees | Indices | Help |
|
---|
|
Automatic completion for optparse module.
This module provide automatic bash completion support for programs that use the optparse module. The premise is that the optparse options parser specifies enough information (and more) for us to be able to generate completion strings esily. Another advantage of this over traditional completion schemes where the completion strings are hard-coded in a separate bash source file, is that the same code that parses the options is used to generate the completions, so the completions is always up-to-date with the program itself.
In addition, we allow you specify a list of regular expressions or code that define what kinds of files should be proposed as completions to this file if needed. If you want to implement more complex behaviour, you can instead specify a function, which will be called with the current directory as an argument.
You need to activate bash completion using the shell script function that comes with optcomplete (see http://furius.ca/optcomplete for more details).
Version: $Revision$
Author: Martin Blais <blais@furius.ca>
|
|||
AllCompleter Completes by listing all possible files in current directory. |
|||
NoneCompleter Generates empty completion list. |
|||
DirCompleter Completes by listing subdirectories only. |
|||
RegexCompleter Completes by filtering all possible files with the given list of regexps. |
|||
ListCompleter Completes by filtering using a fixed list of strings. |
|||
CmdComplete Simple default base class implementation for a subcommand that supports command completion. |
|
|||
|
|||
|
|||
|
|||
|
|||
|
|
|||
debugfn =
|
|||
__package__ =
|
|
Return a prefix and suffix of the enclosing word. The character under the cursor is the first character of the suffix. |
Automatically detect if we are requested completing and if so generate completion automatically from given parser. 'parser' is the options parser to use. 'arg_completer' is a callable object that gets invoked to produce a list of completions for arguments completion (oftentimes files). 'opt_completer' is the default completer to the options that require a value. 'subcmd_completer' is the default completer for the subcommand arguments. If 'subcommands' is specified, the script expects it to be a map of command-name to an object of any kind. We are assuming that this object is a map from command name to a pair of (options parser, completer) for the command. If the value is not such a tuple, the method 'autocomplete(completer)' is invoked on the resulting object. This will attempt to match the first non-option argument into a subcommand name and if so will use the local parser in the corresponding map entry's value. This is used to implement completion for subcommand syntax and will not be needed in most cases. |
Given a global options parser, try to guess the first non-option without generating an exception. This is used for scripts that implement a subcommand syntax, so that we can generate the appropriate completions for the subcommand. |
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Mon Oct 17 13:43:23 2011 | http://epydoc.sourceforge.net |