~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bashcomp.py

Introduce --no-plugins option to script execution mode.

This provides a simple way to suppress generation of any plugin completions.
It doesn't make a lot of sense for cases where bzr-bash-completion is used
as a plugin itself, because then obviously it has to be loaded.

Show diffs side-by-side

added added

removed removed

Lines of Context:
143
143
    return wrap_container(list, parser)
144
144
 
145
145
def bash_completion_function(out, function_name="_bzr", function_only=False,
146
 
                             debug=False):
 
146
                             debug=False, no_plugins=False):
147
147
    cmds = []
148
148
    cases = ""
149
149
    reqarg = {}
263
263
                      help="Generate only the shell function, don't enable it")
264
264
    parser.add_option("--debug", action="store_true",
265
265
                      help=optparse.SUPPRESS_HELP)
 
266
    parser.add_option("--no-plugins", action="store_true",
 
267
                      help="Don't load any bzr plugins")
266
268
    (opts, args) = parser.parse_args()
267
269
    if args:
268
270
        parser.error("script does not take positional arguments")
272
274
            kwargs[name] = value
273
275
 
274
276
    locale.setlocale(locale.LC_ALL, '')
275
 
    plugin.load_plugins()
 
277
    if not kwargs.get('no_plugins', False):
 
278
        plugin.load_plugins()
276
279
    commands.install_bzr_command_hooks()
277
280
    bash_completion_function(sys.stdout, **kwargs)