~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/help.py

  • Committer: John Arbash Meinel
  • Date: 2006-06-26 16:31:49 UTC
  • mfrom: (1813 +trunk)
  • mto: (1711.7.2 win32)
  • mto: This revision was merged to the branch mainline in revision 1822.
  • Revision ID: john@arbash-meinel.com-20060626163149-2213f2f2d895829d
[merge] bzr.dev 1813

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]