~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/help.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-06-19 08:54:42 UTC
  • mfrom: (1733.2.6 mpe)
  • Revision ID: pqm@pqm.ubuntu.com-20060619085442-78ad2b3effaba541
(mpe) show plugin name in help; ancestry takes branch argument

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
    return s
86
86
 
87
87
 
 
88
def print_command_plugin(cmd_object, outfile, format):
 
89
    """Print the plugin that provides a command object, if any.
 
90
 
 
91
    If the cmd_object is provided by a plugin, prints the plugin name to
 
92
    outfile using the provided format string.
 
93
    """
 
94
    plugin_name = cmd_object.plugin_name()
 
95
    if plugin_name is not None:
 
96
        out_str = '(From plugin "%s")' % plugin_name
 
97
        outfile.write(format % out_str)
 
98
 
 
99
 
88
100
def help_on_command(cmdname, outfile=None):
89
101
    from bzrlib.commands import get_cmd_object
90
102
 
107
119
 
108
120
    print >>outfile
109
121
 
 
122
    print_command_plugin(cmd_object, outfile, '%s\n\n')
 
123
 
110
124
    outfile.write(doc)
111
125
    if doc[-1] != '\n':
112
126
        outfile.write('\n')
156
170
        if cmd_object.hidden:
157
171
            continue
158
172
        print >>outfile, command_usage(cmd_object)
 
173
 
 
174
        plugin_name = cmd_object.plugin_name()
 
175
        print_command_plugin(cmd_object, outfile, '        %s\n')
 
176
 
159
177
        cmd_help = cmd_object.help()
160
178
        if cmd_help:
161
179
            firstline = cmd_help.split('\n', 1)[0]