bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.27.2
by Martin von Gagern
First programmatic generation of completions. |
1 |
from bzrlib.commands import Command, register_command |
|
0.27.4
by Martin von Gagern
Introduce --function-name switch. (LP #439829) |
2 |
from bzrlib.option import Option |
|
0.27.2
by Martin von Gagern
First programmatic generation of completions. |
3 |
|
4 |
class cmd_bash_completion(Command): |
|
5 |
"""Generate a shell function for bash command line completion. |
|
6 |
||
7 |
This command generates a shell function which can be used by bash to
|
|
8 |
automatically complete the currently typed command when the user presses
|
|
9 |
the completion key (usually tab).
|
|
10 |
|
|
11 |
Commonly used like this:
|
|
12 |
eval "`bzr bash-completion`"
|
|
13 |
"""
|
|
|
0.27.4
by Martin von Gagern
Introduce --function-name switch. (LP #439829) |
14 |
|
15 |
takes_options = [ |
|
16 |
Option("function-name", short_name="f", type=str, argname="name", |
|
17 |
help="Name of the created autocompletion bash function (default: _bzr)"), |
|
18 |
]
|
|
19 |
||
20 |
def run(self, **kwargs): |
|
|
0.27.2
by Martin von Gagern
First programmatic generation of completions. |
21 |
import sys |
22 |
from bashcomp import bash_completion_function |
|
|
0.27.4
by Martin von Gagern
Introduce --function-name switch. (LP #439829) |
23 |
bash_completion_function(sys.stdout, **kwargs) |
|
0.27.2
by Martin von Gagern
First programmatic generation of completions. |
24 |
|
25 |
register_command(cmd_bash_completion) |