~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to tools/doc_generate/autodoc_man.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-01-13 05:14:24 UTC
  • mfrom: (3936.1.3 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20090113051424-nrk3zkfe09h46i9y
(mbp) merge 1.11 and advance to 1.12

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 
29
29
import bzrlib
30
30
import bzrlib.help
 
31
import bzrlib.help_topics
31
32
import bzrlib.commands
32
33
 
33
34
 
80
81
        cmd_help = cmd_object.help()
81
82
        if cmd_help:
82
83
            firstline = cmd_help.split('\n', 1)[0]
83
 
            usage = bzrlib.help.command_usage(cmd_object)
 
84
            usage = cmd_object._usage()
84
85
            tmp = '.TP\n.B "%s"\n%s\n' % (usage, firstline)
85
86
            output = output + tmp
86
87
        else:
101
102
 
102
103
def format_command (params, cmd):
103
104
    """Provides long help for each public command"""
104
 
    subsection_header = '.SS "%s"\n' % (bzrlib.help.command_usage(cmd))
 
105
    subsection_header = '.SS "%s"\n' % (cmd._usage())
105
106
    doc = "%s\n" % (cmd.__doc__)
106
 
    doc = cmd.help()
 
107
    doc = bzrlib.help_topics.help_as_plain_text(cmd.help())
107
108
 
108
109
    option_str = ""
109
110
    options = cmd.options()
111
112
        option_str = "\nOptions:\n"
112
113
        for option_name, option in sorted(options.items()):
113
114
            for name, short_name, argname, help in option.iter_switches():
 
115
                if option.is_hidden(name):
 
116
                    continue
114
117
                l = '    --' + name
115
118
                if argname is not None:
116
119
                    l += ' ' + argname
117
120
                if short_name:
118
121
                    assert len(short_name) == 1
119
122
                    l += ', -' + short_name
120
 
                l += (30 - len(l)) * ' ' + help
121
 
                # TODO: Split help over multiple lines with
122
 
                # correct indenting and wrapping.
 
123
                l += (30 - len(l)) * ' ' + (help or '')
123
124
                wrapped = textwrap.fill(l, initial_indent='',
124
125
                                        subsequent_indent=30*' ')
125
126
                option_str = option_str + wrapped + '\n'       
133
134
        aliases_str += ', '.join(cmd.aliases)
134
135
        aliases_str += '\n'
135
136
 
136
 
    return subsection_header + option_str + aliases_str + "\n" + doc + "\n"
 
137
    see_also_str = ""
 
138
    see_also = cmd.get_see_also()
 
139
    if see_also:
 
140
        see_also_str += '\nSee also: '
 
141
        see_also_str += ', '.join(see_also)
 
142
        see_also_str += '\n'
 
143
 
 
144
    return subsection_header + option_str + aliases_str + see_also_str + "\n" + doc + "\n"
137
145
 
138
146
 
139
147
man_preamble = """\
140
 
Man page for Bazaar (%(bzrcmd)s)
 
148
.\\\"Man page for Bazaar (%(bzrcmd)s)
141
149
.\\\"
142
150
.\\\" Large parts of this file are autogenerated from the output of
143
151
.\\\"     \"%(bzrcmd)s help commands\"
178
186
.I "BZRPATH"
179
187
Path where
180
188
.B "%(bzrcmd)s"
181
 
is to look for external command.
 
189
is to look for shell plugin external commands.
182
190
.TP
183
191
.I "BZR_EMAIL"
184
192
E-Mail address of the user. Overrides default user config.
200
208
.SH "FILES"
201
209
.TP
202
210
.I "~/.bazaar/bazaar.conf"
203
 
Contains the users default configuration. The section
 
211
Contains the user's default configuration. The section
204
212
.B [DEFAULT]
205
213
is used to define general configuration that will be applied everywhere.
206
214
The section