~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/doc_generate/autodoc_man.py

(jelmer) Support upgrading between the 2a and development-colo formats.
 (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2005 Canonical Ltd.
 
1
# Copyright (C) 2005-2010 Canonical Ltd
2
2
 
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
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
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
"""man.py - create man page from built-in bzr help and static text
18
18
 
92
92
def getcommand_help(params):
93
93
    """Shows individual options for a bzr command"""
94
94
    output='.SH "COMMAND REFERENCE"\n'
 
95
    formatted = {}
95
96
    for cmd_name in command_name_list():
96
97
        cmd_object = bzrlib.commands.get_cmd_object(cmd_name)
97
98
        if cmd_object.hidden:
98
99
            continue
99
 
        output = output + format_command(params, cmd_object)
 
100
        formatted[cmd_name] = format_command(params, cmd_object)
 
101
        for alias in cmd_object.aliases:
 
102
            formatted[alias] = format_alias(params, alias, cmd_name)
 
103
    for cmd_name in sorted(formatted):
 
104
        output += formatted[cmd_name]
100
105
    return output
101
106
 
102
107
 
118
123
                if argname is not None:
119
124
                    l += ' ' + argname
120
125
                if short_name:
121
 
                    assert len(short_name) == 1
122
126
                    l += ', -' + short_name
123
127
                l += (30 - len(l)) * ' ' + (help or '')
124
128
                wrapped = textwrap.fill(l, initial_indent='',
125
 
                                        subsequent_indent=30*' ')
 
129
                    subsequent_indent=30*' ',
 
130
                    break_long_words=False,
 
131
                    )
126
132
                option_str = option_str + wrapped + '\n'       
127
133
 
128
134
    aliases_str = ""
144
150
    return subsection_header + option_str + aliases_str + see_also_str + "\n" + doc + "\n"
145
151
 
146
152
 
 
153
def format_alias(params, alias, cmd_name):
 
154
    help = '.SS "bzr %s"\n' % alias
 
155
    help += 'Alias for "%s", see "bzr %s".\n' % (cmd_name, cmd_name)
 
156
    return help
 
157
 
 
158
 
147
159
man_preamble = """\
148
 
Man page for Bazaar (%(bzrcmd)s)
 
160
.\\\"Man page for Bazaar (%(bzrcmd)s)
149
161
.\\\"
150
162
.\\\" Large parts of this file are autogenerated from the output of
151
163
.\\\"     \"%(bzrcmd)s help commands\"
159
171
man_head = """\
160
172
.TH bzr 1 "%(datestamp)s" "%(version)s" "Bazaar"
161
173
.SH "NAME"
162
 
Bazaar (%(bzrcmd)s) - next-generation distributed version control
 
174
%(bzrcmd)s - Bazaar next-generation distributed version control
163
175
.SH "SYNOPSIS"
164
176
.B "%(bzrcmd)s"
165
177
.I "command"
174
186
.B "help"
175
187
.I "command"
176
188
.SH "DESCRIPTION"
177
 
Bazaar (or %(bzrcmd)s) is a project of Canonical to develop an open source
178
 
distributed version control system that is powerful, friendly, and scalable.
179
 
Version control means a system that keeps track of previous revisions
180
 
of software source code or similar information and helps people work on it in teams.
 
189
 
 
190
Bazaar (or %(bzrcmd)s) is a distributed version control system that is powerful, 
 
191
friendly, and scalable.  Bazaar is a project of Canonical Ltd and part of 
 
192
the GNU Project to develop a free operating system.
 
193
 
 
194
Bazaar keeps track of changes to software source code (or similar information);
 
195
lets you explore who changed it, when, and why; merges concurrent changes; and
 
196
helps people work together in a team.
181
197
"""
182
198
 
183
199
man_foot = """\
229
245
.br
230
246
log10 = log --short -r -10..-1
231
247
.SH "SEE ALSO"
232
 
.UR http://www.bazaar-vcs.org/
233
 
.BR http://www.bazaar-vcs.org/
 
248
.UR http://bazaar.canonical.com/
 
249
.BR http://bazaar.canonical.com/
234
250
"""
235
251