~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: 2006-08-17 13:49:05 UTC
  • mfrom: (1711.2.129 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060817134905-0dec610d2fcd6663
(bialix) 'make html-docs' produces html documentation

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