~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/shellcomplete.py

  • Committer: Robey Pointer
  • Date: 2006-09-08 18:46:29 UTC
  • mto: This revision was merged to the branch mainline in revision 1996.
  • Revision ID: robey@lag.net-20060908184629-e3fc4c61ca21508c
pychecker is on crack; go back to using 'is None'.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
 
4
4
def shellcomplete(context=None, outfile = None):
5
 
    if outfile == None:
 
5
    if outfile is None:
6
6
        outfile = sys.stdout
7
 
    if context == None:
 
7
    if context is None:
8
8
        shellcomplete_commands(outfile = outfile)
9
9
    else:
10
10
        shellcomplete_on_command(context, outfile = outfile)
12
12
def shellcomplete_on_command(cmdname, outfile = None):
13
13
    cmdname = str(cmdname)
14
14
 
15
 
    if outfile == None:
 
15
    if outfile is None:
16
16
        outfile = sys.stdout
17
17
 
18
18
    from inspect import getdoc
20
20
    cmdobj = commands.get_cmd_object(cmdname)
21
21
 
22
22
    doc = getdoc(cmdobj)
23
 
    if doc == None:
 
23
    if doc is None:
24
24
        raise NotImplementedError("sorry, no detailed shellcomplete yet for %r" % cmdname)
25
25
 
26
26
    shellcomplete_on_option(cmdobj.takes_options, outfile = None)
32
32
    from bzrlib.option import Option
33
33
    if not options:
34
34
        return
35
 
    if outfile == None:
 
35
    if outfile is None:
36
36
        outfile = sys.stdout
37
37
    for on in options:
38
38
        for shortname, longname in Option.SHORT_OPTIONS.items():
50
50
    import commands
51
51
    from inspect import getdoc
52
52
    
53
 
    if outfile == None:
 
53
    if outfile is None:
54
54
        outfile = sys.stdout
55
55
    
56
56
    cmds = []
63
63
        if cmdclass.hidden:
64
64
            continue
65
65
        doc = getdoc(cmdclass)
66
 
        if doc == None:
 
66
        if doc is None:
67
67
            outfile.write(cmdname + '\n')
68
68
        else:
69
69
            doclines = doc.splitlines()