~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/shellcomplete.py

  • Committer: John Arbash Meinel
  • Date: 2005-12-01 17:25:16 UTC
  • mto: (1185.50.19 bzr-jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1532.
  • Revision ID: john@arbash-meinel.com-20051201172516-5232226cd9ec1f0e
A couple more path.join statements needed changing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
    from inspect import getdoc
19
19
    import commands
20
 
    context, cmdclass = commands.get_cmd_class(cmdname)
 
20
    cmdobj = commands.get_cmd_object(cmdname)
21
21
 
22
 
    doc = getdoc(cmdclass)
 
22
    doc = getdoc(cmdobj)
23
23
    if doc == None:
24
24
        raise NotImplementedError("sorry, no detailed shellcomplete yet for %r" % cmdname)
25
25
 
26
 
    shellcomplete_on_option(cmdclass.takes_options, outfile = None)
27
 
    for aname in cmdclass.takes_args:
28
 
            outfile.write(aname + '\n')
29
 
 
30
 
 
31
 
def shellcomplete_on_option(options, outfile = None):
32
 
    import commands
33
 
    
 
26
    shellcomplete_on_option(cmdobj.takes_options, outfile = None)
 
27
    for aname in cmdobj.takes_args:
 
28
        outfile.write(aname + '\n')
 
29
 
 
30
 
 
31
def shellcomplete_on_option(options, outfile=None):
 
32
    from bzrlib.option import Option
34
33
    if not options:
35
34
        return
36
 
    
37
35
    if outfile == None:
38
36
        outfile = sys.stdout
39
 
 
40
37
    for on in options:
41
 
        for shortname, longname in commands.SHORT_OPTIONS.items():
 
38
        for shortname, longname in Option.SHORT_OPTIONS.items():
42
39
            if longname == on:
43
40
                l = '"(--' + on + ' -' + shortname + ')"{--' + on + ',-' + shortname + '}'
44
41
                break