~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/help.py

  • Committer: Olaf Conradi
  • Date: 2006-03-28 23:30:02 UTC
  • mto: (1661.1.1 bzr.mbp.remember)
  • mto: This revision was merged to the branch mainline in revision 1663.
  • Revision ID: olaf@conradi.org-20060328233002-f6262df0e19c1963
Added testcases for using pull with --remember. Moved remember code to
beginning of cmd_pull. This remembers the location in case of a failure
during pull.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
# executable files with reasonable names.
21
21
 
22
22
# TODO: `help commands --all` should show hidden commands
 
23
import textwrap
23
24
 
24
25
global_help = \
25
26
"""Bazaar-NG -- a free distributed version-control tool
112
113
    outfile.write(doc)
113
114
    if doc[-1] != '\n':
114
115
        outfile.write('\n')
115
 
    help_on_command_options(cmd_object, outfile=None)
 
116
    help_on_command_options(cmd_object, outfile)
116
117
 
117
118
 
118
119
def help_on_command_options(cmd, outfile=None):
130
131
        short_name = option.short_name()
131
132
        if short_name:
132
133
            assert len(short_name) == 1
133
 
            l += ', -' + shortname
 
134
            l += ', -' + short_name
134
135
        l += (30 - len(l)) * ' ' + option.help
135
136
        # TODO: split help over multiple lines with correct indenting and 
136
137
        # wrapping
137
 
        outfile.write(l + '\n')
 
138
        wrapped = textwrap.fill(l, initial_indent='', subsequent_indent=30*' ')
 
139
        outfile.write(wrapped + '\n')
138
140
 
139
141
 
140
142
def help_commands(outfile=None):
160
162
        cmd_help = cmd_object.help()
161
163
        if cmd_help:
162
164
            firstline = cmd_help.split('\n', 1)[0]
163
 
            print >>outfile, '    ' + firstline
 
165
            print >>outfile, '        ' + firstline
164
166