~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to tools/doc_generate/autodoc_rstx.py

  • Committer: Robert Collins
  • Date: 2007-07-04 08:08:13 UTC
  • mfrom: (2572 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2587.
  • Revision ID: robertc@robertcollins.net-20070704080813-wzebx0r88fvwj5rq
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
        cmd_help = cmd_object.help()
74
74
        if cmd_help:
75
75
            firstline = cmd_help.split('\n', 1)[0]
76
 
            usage = bzrlib.help.command_usage(cmd_object)
 
76
            usage = cmd_object._usage()
77
77
            tmp = '**%s**\n\t%s\n\n' % (usage, firstline)
78
78
            output = output + tmp
79
79
        else:
97
97
 
98
98
def format_command (params, cmd, name):
99
99
    """Provides long help for each public command"""
100
 
    usage = bzrlib.help.command_usage(cmd)
 
100
    usage = cmd._usage()
101
101
    subsection_header = """
102
102
%s
103
103
%s
112
112
    if options:
113
113
        option_str = "\n    Options:\n"
114
114
        for option_name, option in sorted(options.items()):
115
 
            l = '        --' + option_name
116
 
            if option.type is not None:
117
 
                l += ' ' + option.argname.upper()
118
 
            short_name = option.short_name()
119
 
            if short_name:
120
 
                assert len(short_name) == 1
121
 
                l += ', -' + short_name
122
 
            l += (30 - len(l)) * ' ' + option.help
123
 
            # TODO: Split help over multiple lines with
124
 
            # correct indenting and wrapping.
125
 
            wrapped = textwrap.fill(l, initial_indent='',
126
 
                                    subsequent_indent=30*' ')
127
 
            option_str = option_str + wrapped + '\n'
 
115
            for name, short_name, argname, help in option.iter_switches():
 
116
                l = '    --' + name
 
117
                if argname is not None:
 
118
                    l += ' ' + argname
 
119
                if short_name:
 
120
                    assert len(short_name) == 1
 
121
                    l += ', -' + short_name
 
122
                l += (30 - len(l)) * ' ' + (help or '')
 
123
                # TODO: Split help over multiple lines with
 
124
                # correct indenting and wrapping.
 
125
                wrapped = textwrap.fill(l, initial_indent='',
 
126
                                        subsequent_indent=30*' ')
 
127
                option_str = option_str + wrapped + '\n'       
128
128
 
129
129
    aliases_str = ""
130
130
    if cmd.aliases:
135
135
        aliases_str += ', '.join(cmd.aliases)
136
136
        aliases_str += '\n'
137
137
 
138
 
    return subsection_header + option_str + aliases_str + "\n" + doc + "\n"
 
138
    see_also_str = ""
 
139
    see_also = cmd.get_see_also()
 
140
    if see_also:
 
141
        see_also_str += '\n    See also: '
 
142
        see_also_str += ', '.join(see_also)
 
143
        see_also_str += '\n'
 
144
 
 
145
    return subsection_header + option_str + aliases_str + see_also_str + "\n" + doc + "\n"
139
146
 
140
147
 
141
148
##
188
195
Environment
189
196
===========
190
197
**BZRPATH**
191
 
                Path where **%(bzrcmd)s** is to look for external command.
 
198
                Path where **%(bzrcmd)s** is to look for shell plugin external commands.
192
199
 
193
200
**BZR_EMAIL**
194
201
                E-Mail address of the user. Overrides default user config.
195
202
 
196
203
**EMAIL**
197
 
                E-Mail address of the user. Overriddes default user config.
 
204
                E-Mail address of the user. Overrides default user config.
198
205
 
199
206
**BZR_EDITOR**
200
207
                Editor for editing commit messages
216
223
 
217
224
**On Windows**: ``C:\\Documents and Settings\\username\\Application Data\\bazaar\\2.0\\bazaar.conf``
218
225
 
219
 
Contains the users default configuration. The section ``[DEFAULT]`` is
 
226
Contains the user's default configuration. The section ``[DEFAULT]`` is
220
227
used to define general configuration that will be applied everywhere.
221
228
The section ``[ALIASES]`` can be used to create command aliases for
222
229
commonly used options.