/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 bzrlib/shellcomplete.py

  • Committer: Aaron Bentley
  • Date: 2006-11-17 04:06:03 UTC
  • mfrom: (2139 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2162.
  • Revision ID: aaron.bentley@utoronto.ca-20061117040603-pgebxndswvwk26tt
Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2005, 2006 Canonical Ltd
 
2
#
 
3
# This program is free software; you can redistribute it and/or modify
 
4
# it under the terms of the GNU General Public License as published by
 
5
# the Free Software Foundation; either version 2 of the License, or
 
6
# (at your option) any later version.
 
7
#
 
8
# This program is distributed in the hope that it will be useful,
 
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
# GNU General Public License for more details.
 
12
#
 
13
# You should have received a copy of the GNU General Public License
 
14
# along with this program; if not, write to the Free Software
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
16
 
1
17
import sys
2
18
 
3
19
 
39
55
            if longname == on:
40
56
                l = '"(--' + on + ' -' + shortname + ')"{--' + on + ',-' + shortname + '}'
41
57
                break
42
 
            else:
43
 
                l = '--' + on
 
58
            else:
 
59
                l = '--' + on
44
60
        outfile.write(l + '\n')
45
61
 
46
62
 
56
72
    cmds = []
57
73
    for cmdname, cmdclass in commands.get_all_cmds():
58
74
        cmds.append((cmdname, cmdclass))
59
 
        for alias in cmdclass.aliases:
60
 
            cmds.append((alias, cmdclass))
 
75
        for alias in cmdclass.aliases:
 
76
            cmds.append((alias, cmdclass))
61
77
    cmds.sort()
62
78
    for cmdname, cmdclass in cmds:
63
79
        if cmdclass.hidden:
64
80
            continue
65
81
        doc = getdoc(cmdclass)
66
82
        if doc is None:
67
 
            outfile.write(cmdname + '\n')
 
83
            outfile.write(cmdname + '\n')
68
84
        else:
69
 
            doclines = doc.splitlines()
70
 
            firstline = doclines[0].lower()
71
 
            outfile.write(cmdname + ':' + firstline[0:-1] + '\n')
 
85
            doclines = doc.splitlines()
 
86
            firstline = doclines[0].lower()
 
87
            outfile.write(cmdname + ':' + firstline[0:-1] + '\n')