/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/shellcomplete.py

  • Committer: Jelmer Vernooij
  • Date: 2018-11-17 00:47:52 UTC
  • mfrom: (7182 work)
  • mto: This revision was merged to the branch mainline in revision 7305.
  • Revision ID: jelmer@jelmer.uk-20181117004752-6ywampe5pfywlby4
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
import sys
20
20
 
21
21
 
22
 
def shellcomplete(context=None, outfile = None):
 
22
def shellcomplete(context=None, outfile=None):
23
23
    if outfile is None:
24
24
        outfile = sys.stdout
25
25
    if context is None:
26
 
        shellcomplete_commands(outfile = outfile)
 
26
        shellcomplete_commands(outfile=outfile)
27
27
    else:
28
 
        shellcomplete_on_command(context, outfile = outfile)
 
28
        shellcomplete_on_command(context, outfile=outfile)
29
29
 
30
30
 
31
31
def shellcomplete_on_command(cmdname, outfile=None):
40
40
 
41
41
    doc = getdoc(cmdobj)
42
42
    if doc is None:
43
 
        raise NotImplementedError("sorry, no detailed shellcomplete yet for %r" % cmdname)
 
43
        raise NotImplementedError(
 
44
            "sorry, no detailed shellcomplete yet for %r" % cmdname)
44
45
 
45
46
    shellcomplete_on_options(cmdobj.options().values(), outfile=outfile)
46
47
    for aname in cmdobj.takes_args:
52
53
        short_name = opt.short_name()
53
54
        if short_name:
54
55
            outfile.write('"(--%s -%s)"{--%s,-%s}\n'
55
 
                    % (opt.name, short_name, opt.name, short_name))
 
56
                          % (opt.name, short_name, opt.name, short_name))
56
57
        else:
57
58
            outfile.write('--%s\n' % opt.name)
58
59