~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to tools/doc_generate/autodoc_man.py

  • Committer: Matt Nordhoff
  • Date: 2009-04-04 02:50:01 UTC
  • mfrom: (4253 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4256.
  • Revision ID: mnordhoff@mattnordhoff.com-20090404025001-z1403k0tatmc8l91
Merge bzr.dev, fixing conflicts.

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., 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
 
144
149
    return subsection_header + option_str + aliases_str + see_also_str + "\n" + doc + "\n"
145
150
 
146
151
 
 
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
 
147
158
man_preamble = """\
148
159
.\\\"Man page for Bazaar (%(bzrcmd)s)
149
160
.\\\"