~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to tools/doc_generate/autodoc_man.py

  • Committer: Aaron Bentley
  • Date: 2007-08-16 00:54:00 UTC
  • mto: This revision was merged to the branch mainline in revision 2711.
  • Revision ID: aaron.bentley@utoronto.ca-20070816005400-oxxtqiy310wx10h9
Fix typo

Show diffs side-by-side

added added

removed removed

Lines of Context:
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  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 = {}
96
95
    for cmd_name in command_name_list():
97
96
        cmd_object = bzrlib.commands.get_cmd_object(cmd_name)
98
97
        if cmd_object.hidden:
99
98
            continue
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]
 
99
        output = output + format_command(params, cmd_object)
105
100
    return output
106
101
 
107
102
 
117
112
        option_str = "\nOptions:\n"
118
113
        for option_name, option in sorted(options.items()):
119
114
            for name, short_name, argname, help in option.iter_switches():
120
 
                if option.is_hidden(name):
121
 
                    continue
122
115
                l = '    --' + name
123
116
                if argname is not None:
124
117
                    l += ' ' + argname
149
142
    return subsection_header + option_str + aliases_str + see_also_str + "\n" + doc + "\n"
150
143
 
151
144
 
152
 
def format_alias(params, alias, cmd_name):
153
 
    help = '.SS "bzr %s"\n' % alias
154
 
    help += 'Alias for "%s", see "bzr %s".\n' % (cmd_name, cmd_name)
155
 
    return help
156
 
 
157
 
 
158
145
man_preamble = """\
159
 
.\\\"Man page for Bazaar (%(bzrcmd)s)
 
146
Man page for Bazaar (%(bzrcmd)s)
160
147
.\\\"
161
148
.\\\" Large parts of this file are autogenerated from the output of
162
149
.\\\"     \"%(bzrcmd)s help commands\"