/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/doc_generate/autodoc_man.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-21 19:09:26 UTC
  • mfrom: (6622.1.36 breezy)
  • Revision ID: jelmer@jelmer.uk-20170521190926-5vtz8xaf0e9ylrpc
Merge rename to breezy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
"""man.py - create man page from built-in bzr help and static text
 
17
"""man.py - create man page from built-in brz help and static text
18
18
 
19
19
TODO:
20
 
  * use usage information instead of simple "bzr foo" in COMMAND OVERVIEW
 
20
  * use usage information instead of simple "brz foo" in COMMAND OVERVIEW
21
21
  * add command aliases
22
22
"""
23
23
 
28
28
import textwrap
29
29
import time
30
30
 
31
 
import bzrlib
32
 
import bzrlib.help
33
 
import bzrlib.help_topics
34
 
import bzrlib.commands
35
 
import bzrlib.osutils
 
31
import breezy
 
32
import breezy.help
 
33
import breezy.help_topics
 
34
import breezy.commands
 
35
import breezy.osutils
36
36
 
37
 
from bzrlib.plugin import load_plugins
 
37
from breezy.plugin import load_plugins
38
38
load_plugins()
39
39
 
40
40
 
41
41
def get_filename(options):
42
42
    """Provides name of manpage"""
43
 
    return "%s.1" % (options.bzr_name)
 
43
    return "%s.1" % (options.brz_name)
44
44
 
45
45
 
46
46
def infogen(options, outfile):
47
47
    """Assembles a man page"""
48
 
    tt = bzrlib.osutils.gmtime()
 
48
    tt = breezy.osutils.gmtime()
49
49
    params = \
50
 
           { "bzrcmd": options.bzr_name,
 
50
           { "bzrcmd": options.brz_name,
51
51
             "datestamp": time.strftime("%Y-%m-%d",tt),
52
52
             "timestamp": time.strftime("%Y-%m-%d %H:%M:%S +0000",tt),
53
 
             "version": bzrlib.__version__,
 
53
             "version": breezy.__version__,
54
54
             }
55
55
    outfile.write(man_preamble % params)
56
56
    outfile.write(man_escape(man_head % params))
70
70
 
71
71
 
72
72
def command_name_list():
73
 
    """Builds a list of command names from bzrlib"""
74
 
    command_names = bzrlib.commands.builtin_command_names()
75
 
    for cmdname in bzrlib.commands.plugin_command_names():
76
 
        cmd_object = bzrlib.commands.get_cmd_object(cmdname)
 
73
    """Builds a list of command names from breezy"""
 
74
    command_names = breezy.commands.builtin_command_names()
 
75
    for cmdname in breezy.commands.plugin_command_names():
 
76
        cmd_object = breezy.commands.get_cmd_object(cmdname)
77
77
        if (PLUGINS_TO_DOCUMENT is None or
78
78
            cmd_object.plugin_name() in PLUGINS_TO_DOCUMENT):
79
79
            command_names.append(cmdname)
86
86
    bzrcmd = params["bzrcmd"]
87
87
    output = '.SH "COMMAND OVERVIEW"\n'
88
88
    for cmd_name in command_name_list():
89
 
        cmd_object = bzrlib.commands.get_cmd_object(cmd_name)
 
89
        cmd_object = breezy.commands.get_cmd_object(cmd_name)
90
90
        if cmd_object.hidden:
91
91
            continue
92
92
        cmd_help = cmd_object.help()
101
101
 
102
102
 
103
103
def getcommand_help(params):
104
 
    """Shows individual options for a bzr command"""
 
104
    """Shows individual options for a brz command"""
105
105
    output='.SH "COMMAND REFERENCE"\n'
106
106
    formatted = {}
107
107
    for cmd_name in command_name_list():
108
 
        cmd_object = bzrlib.commands.get_cmd_object(cmd_name)
 
108
        cmd_object = breezy.commands.get_cmd_object(cmd_name)
109
109
        if cmd_object.hidden:
110
110
            continue
111
111
        formatted[cmd_name] = format_command(params, cmd_object)
120
120
    """Provides long help for each public command"""
121
121
    subsection_header = '.SS "%s"\n' % (cmd._usage())
122
122
    doc = "%s\n" % (cmd.__doc__)
123
 
    doc = bzrlib.help_topics.help_as_plain_text(cmd.help())
 
123
    doc = breezy.help_topics.help_as_plain_text(cmd.help())
124
124
 
125
125
    # A dot at the beginning of a line is interpreted as a macro.
126
126
    # Simply join lines that begin with a dot with the previous
167
167
 
168
168
 
169
169
def format_alias(params, alias, cmd_name):
170
 
    help = '.SS "bzr %s"\n' % alias
171
 
    help += 'Alias for "%s", see "bzr %s".\n' % (cmd_name, cmd_name)
 
170
    help = '.SS "brz %s"\n' % alias
 
171
    help += 'Alias for "%s", see "brz %s".\n' % (cmd_name, cmd_name)
172
172
    return help
173
173
 
174
174
 
175
175
def environment_variables():
176
176
    yield ".SH \"ENVIRONMENT\"\n"
177
177
 
178
 
    from bzrlib.help_topics import known_env_variables
 
178
    from breezy.help_topics import known_env_variables
179
179
    for k, desc in known_env_variables:
180
180
        yield ".TP\n"
181
181
        yield ".I \"%s\"\n" % k
183
183
 
184
184
 
185
185
man_preamble = """\
186
 
.\\\"Man page for Bazaar (%(bzrcmd)s)
 
186
.\\\"Man page for Breezy (%(bzrcmd)s)
187
187
.\\\"
188
188
.\\\" Large parts of this file are autogenerated from the output of
189
189
.\\\"     \"%(bzrcmd)s help commands\"
196
196
 
197
197
 
198
198
man_head = """\
199
 
.TH bzr 1 "%(datestamp)s" "%(version)s" "Bazaar"
 
199
.TH brz 1 "%(datestamp)s" "%(version)s" "Breezy"
200
200
.SH "NAME"
201
 
%(bzrcmd)s - Bazaar next-generation distributed version control
 
201
%(bzrcmd)s - Breezy next-generation distributed version control
202
202
.SH "SYNOPSIS"
203
203
.B "%(bzrcmd)s"
204
204
.I "command"
214
214
.I "command"
215
215
.SH "DESCRIPTION"
216
216
 
217
 
Bazaar (or %(bzrcmd)s) is a distributed version control system that is powerful, 
218
 
friendly, and scalable.  Bazaar is a project of Canonical Ltd and part of 
219
 
the GNU Project to develop a free operating system.
 
217
Breezy (or %(bzrcmd)s) is a distributed version control system that is powerful,
 
218
friendly, and scalable.  Breezy is a fork of the Bazaar version control system.
220
219
 
221
 
Bazaar keeps track of changes to software source code (or similar information);
 
220
Breezy keeps track of changes to software source code (or similar information);
222
221
lets you explore who changed it, when, and why; merges concurrent changes; and
223
222
helps people work together in a team.
224
223
"""