25
25
from meta import __version__
27
from bzrlib.commands import Command, register_command
28
from bzrlib.option import Option, ListOption
30
class cmd_bash_completion(Command):
27
from bzrlib import commands, option
30
class cmd_bash_completion(commands.Command):
31
31
"""Generate a shell function for bash command line completion.
33
33
This command generates a shell function which can be used by bash to
42
Option("function-name", short_name="f", type=str, argname="name",
42
option.Option("function-name", short_name="f", type=str, argname="name",
43
43
help="Name of the generated function (default: _bzr)"),
44
Option("function-only", short_name="o", type=None,
44
option.Option("function-only", short_name="o", type=None,
45
45
help="Generate only the shell function, don't enable it"),
46
Option("debug", type=None, hidden=True,
46
option.Option("debug", type=None, hidden=True,
47
47
help="Enable shell code useful for debugging"),
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)"),
48
option.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)"),
54
54
def run(self, **kwargs):
60
60
del kwargs['plugin']
61
61
bash_completion_function(sys.stdout, **kwargs)
63
register_command(cmd_bash_completion)
64
commands.register_command(cmd_bash_completion)
65
67
def load_tests(basic_tests, module, loader):