~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/help.py

  • Committer: Robert Collins
  • Date: 2006-08-08 23:19:29 UTC
  • mfrom: (1884 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1912.
  • Revision ID: robertc@robertcollins.net-20060808231929-4e3e298190214b3a
current status

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]