~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/plugins/bash_completion/__init__.py

  • Committer: Martin von Gagern
  • Date: 2010-04-30 17:39:28 UTC
  • mfrom: (0.32.10 trunk)
  • mto: This revision was merged to the branch mainline in revision 5240.
  • Revision ID: martin.vgagern@gmx.net-20100430173928-98cnneu1nmh1fd0k
merge from bzr-bash-completion trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
from meta import *
24
24
from meta import __version__
25
25
 
26
 
from bzrlib.commands import Command, register_command
27
 
from bzrlib.option import Option, ListOption
28
 
 
29
 
class cmd_bash_completion(Command):
 
26
from bzrlib import commands, option
 
27
 
 
28
 
 
29
class cmd_bash_completion(commands.Command):
30
30
    """Generate a shell function for bash command line completion.
31
31
 
32
32
    This command generates a shell function which can be used by bash to
38
38
    """
39
39
 
40
40
    takes_options = [
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)"),
51
51
        ]
52
52
 
53
53
    def run(self, **kwargs):
59
59
            del kwargs['plugin']
60
60
        bash_completion_function(sys.stdout, **kwargs)
61
61
 
62
 
register_command(cmd_bash_completion)
 
62
 
 
63
commands.register_command(cmd_bash_completion)
 
64
 
 
65
 
 
66
def load_tests(basic_tests, module, loader):
 
67
    testmod_names = [
 
68
        'tests',
 
69
        ]
 
70
    basic_tests.addTest(loader.loadTestsFromModuleNames(
 
71
            ["%s.%s" % (__name__, tmn) for tmn in testmod_names]))
 
72
    return basic_tests