/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: Gustav Hartvigsson
  • Date: 2021-01-09 21:36:27 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210109213627-h1xwcutzy9m7a99b
Added 'Case Preserving Working Tree Use Cases' from Canonical Wiki

* Addod a page from the Canonical Bazaar wiki
  with information on the scmeatics of case
  perserving filesystems an a case insensitive
  filesystem works.
  
  * Needs re-work, but this will do as it is the
    same inforamoton as what was on the linked
    page in the currint documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
import sys
18
18
 
19
19
 
20
 
def shellcomplete(context=None, outfile = None):
 
20
def shellcomplete(context=None, outfile=None):
21
21
    if outfile is None:
22
22
        outfile = sys.stdout
23
23
    if context is None:
24
 
        shellcomplete_commands(outfile = outfile)
 
24
        shellcomplete_commands(outfile=outfile)
25
25
    else:
26
 
        shellcomplete_on_command(context, outfile = outfile)
 
26
        shellcomplete_on_command(context, outfile=outfile)
27
27
 
28
28
 
29
29
def shellcomplete_on_command(cmdname, outfile=None):
33
33
        outfile = sys.stdout
34
34
 
35
35
    from inspect import getdoc
36
 
    import commands
 
36
    from . import commands
37
37
    cmdobj = commands.get_cmd_object(cmdname)
38
38
 
39
39
    doc = getdoc(cmdobj)
40
40
    if doc is None:
41
 
        raise NotImplementedError("sorry, no detailed shellcomplete yet for %r" % cmdname)
 
41
        raise NotImplementedError(
 
42
            "sorry, no detailed shellcomplete yet for %r" % cmdname)
42
43
 
43
44
    shellcomplete_on_options(cmdobj.options().values(), outfile=outfile)
44
45
    for aname in cmdobj.takes_args:
50
51
        short_name = opt.short_name()
51
52
        if short_name:
52
53
            outfile.write('"(--%s -%s)"{--%s,-%s}\n'
53
 
                    % (opt.name, short_name, opt.name, short_name))
 
54
                          % (opt.name, short_name, opt.name, short_name))
54
55
        else:
55
56
            outfile.write('--%s\n' % opt.name)
56
57
 
57
58
 
58
 
def shellcomplete_commands(outfile = None):
 
59
def shellcomplete_commands(outfile=None):
59
60
    """List all commands"""
60
 
    import inspect
61
 
    import commands
 
61
    from . import commands
62
62
    from inspect import getdoc
63
63
 
64
64
    commands.install_bzr_command_hooks()