bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.27.14
by Martin von Gagern
Added GPL 2 license document and copyright notice. |
1 |
# Copyright (C) 2009, 2010 Martin von Gagern
|
2 |
#
|
|
3 |
# This file is part of bzr-bash-completion
|
|
4 |
#
|
|
5 |
# bzr-bash-completion free software: you can redistribute it and/or
|
|
6 |
# modify it under the terms of the GNU General Public License as
|
|
7 |
# published by the Free Software Foundation, either version 2 of the
|
|
8 |
# License, or (at your option) any later version.
|
|
9 |
#
|
|
10 |
# bzr-bash-completion is distributed in the hope that it will be
|
|
11 |
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
|
12 |
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
13 |
# General Public License for more details.
|
|
14 |
#
|
|
15 |
# You should have received a copy of the GNU General Public License
|
|
16 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17 |
||
|
0.27.11
by Martin von Gagern
Add module docstring. |
18 |
"""Generate a shell function for bash command line completion.
|
19 |
||
20 |
This plugin provides a command called bash-completion that generates a
|
|
21 |
bash completion function for bzr. See its documentation for details.
|
|
22 |
"""
|
|
23 |
||
|
0.27.16
by Martin von Gagern
Added distutils setup script and plugin meta data. |
24 |
from meta import * |
25 |
from meta import __version__ |
|
26 |
||
|
0.27.2
by Martin von Gagern
First programmatic generation of completions. |
27 |
from bzrlib.commands import Command, register_command |
|
0.27.38
by Martin von Gagern
Add --plugin switch to selectively include plugins. |
28 |
from bzrlib.option import Option, ListOption |
|
0.27.2
by Martin von Gagern
First programmatic generation of completions. |
29 |
|
30 |
class cmd_bash_completion(Command): |
|
31 |
"""Generate a shell function for bash command line completion. |
|
32 |
||
33 |
This command generates a shell function which can be used by bash to
|
|
34 |
automatically complete the currently typed command when the user presses
|
|
35 |
the completion key (usually tab).
|
|
36 |
|
|
37 |
Commonly used like this:
|
|
38 |
eval "`bzr bash-completion`"
|
|
39 |
"""
|
|
|
0.27.4
by Martin von Gagern
Introduce --function-name switch. (LP #439829) |
40 |
|
41 |
takes_options = [ |
|
42 |
Option("function-name", short_name="f", type=str, argname="name", |
|
|
0.27.8
by Martin von Gagern
Shorter help message for --function-name |
43 |
help="Name of the generated function (default: _bzr)"), |
|
0.27.7
by Martin von Gagern
Introduce --function-only option |
44 |
Option("function-only", short_name="o", type=None, |
45 |
help="Generate only the shell function, don't enable it"), |
|
|
0.27.31
by Martin von Gagern
Introduce --debug switch to enable some debugging code. |
46 |
Option("debug", type=None, hidden=True, |
47 |
help="Enable shell code useful for debugging"), |
|
|
0.27.38
by Martin von Gagern
Add --plugin switch to selectively include plugins. |
48 |
ListOption("plugin", type=str, argname="name", |
49 |
# param_name="selected_plugins", # doesn't work, bug #387117
|
|
50 |
help="Enable completions for the selected plugin" |
|
51 |
+ " (default: all plugins)"), |
|
|
0.27.4
by Martin von Gagern
Introduce --function-name switch. (LP #439829) |
52 |
]
|
53 |
||
54 |
def run(self, **kwargs): |
|
|
0.27.2
by Martin von Gagern
First programmatic generation of completions. |
55 |
import sys |
56 |
from bashcomp import bash_completion_function |
|
|
0.27.38
by Martin von Gagern
Add --plugin switch to selectively include plugins. |
57 |
if 'plugin' in kwargs: |
58 |
# work around bug #387117 which prevents us from using param_name
|
|
59 |
kwargs['selected_plugins'] = kwargs['plugin'] |
|
60 |
del kwargs['plugin'] |
|
|
0.27.4
by Martin von Gagern
Introduce --function-name switch. (LP #439829) |
61 |
bash_completion_function(sys.stdout, **kwargs) |
|
0.27.2
by Martin von Gagern
First programmatic generation of completions. |
62 |
|
63 |
register_command(cmd_bash_completion) |
|
|
0.32.4
by Martin von Gagern
Added some selftests executed through bash. |
64 |
|
65 |
def load_tests(basic_tests, module, loader): |
|
66 |
testmod_names = [ |
|
67 |
'tests', |
|
68 |
]
|
|
69 |
basic_tests.addTest(loader.loadTestsFromModuleNames( |
|
70 |
["%s.%s" % (__name__, tmn) for tmn in testmod_names])) |
|
71 |
return basic_tests |