24
24
from meta import __version__
26
from bzrlib.commands import Command, register_command
27
from bzrlib.option import Option, ListOption
29
class cmd_bash_completion(Command):
26
from bzrlib import commands, option
29
class cmd_bash_completion(commands.Command):
30
30
"""Generate a shell function for bash command line completion.
32
32
This command generates a shell function which can be used by bash to
41
Option("function-name", short_name="f", type=str, argname="name",
41
option.Option("function-name", short_name="f", type=str, argname="name",
42
42
help="Name of the generated function (default: _bzr)"),
43
Option("function-only", short_name="o", type=None,
43
option.Option("function-only", short_name="o", type=None,
44
44
help="Generate only the shell function, don't enable it"),
45
Option("debug", type=None, hidden=True,
45
option.Option("debug", type=None, hidden=True,
46
46
help="Enable shell code useful for debugging"),
47
ListOption("plugin", type=str, argname="name",
48
# param_name="selected_plugins", # doesn't work, bug #387117
49
help="Enable completions for the selected plugin"
50
+ " (default: all plugins)"),
47
option.ListOption("plugin", type=str, argname="name",
48
# param_name="selected_plugins", # doesn't work, bug #387117
49
help="Enable completions for the selected plugin"
50
+ " (default: all plugins)"),
53
53
def run(self, **kwargs):
59
59
del kwargs['plugin']
60
60
bash_completion_function(sys.stdout, **kwargs)
62
register_command(cmd_bash_completion)
63
commands.register_command(cmd_bash_completion)
66
def load_tests(basic_tests, module, loader):
70
basic_tests.addTest(loader.loadTestsFromModuleNames(
71
["%s.%s" % (__name__, tmn) for tmn in testmod_names]))