~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to tools/doc_generate/autodoc_man.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-08-16 16:53:53 UTC
  • mfrom: (1857.1.24 optparse)
  • Revision ID: pqm@pqm.ubuntu.com-20060816165353-bc26ccbe32f89d60
Use optparse for option decoding, support inverse options

Show diffs side-by-side

added added

removed removed

Lines of Context:
110
110
    if options:
111
111
        option_str = "\nOptions:\n"
112
112
        for option_name, option in sorted(options.items()):
113
 
            l = '    --' + option_name
114
 
            if option.type is not None:
115
 
                l += ' ' + option.argname.upper()
116
 
            short_name = option.short_name()
117
 
            if short_name:
118
 
                assert len(short_name) == 1
119
 
                l += ', -' + short_name
120
 
            l += (30 - len(l)) * ' ' + option.help
121
 
            # TODO: Split help over multiple lines with
122
 
            # correct indenting and wrapping.
123
 
            wrapped = textwrap.fill(l, initial_indent='',
124
 
                                    subsequent_indent=30*' ')
125
 
            option_str = option_str + wrapped + '\n'       
 
113
            for name, short_name, argname, help in option.iter_switches():
 
114
                l = '    --' + name
 
115
                if argname is not None:
 
116
                    l += ' ' + argname
 
117
                if short_name:
 
118
                    assert len(short_name) == 1
 
119
                    l += ', -' + short_name
 
120
                l += (30 - len(l)) * ' ' + help
 
121
                # TODO: Split help over multiple lines with
 
122
                # correct indenting and wrapping.
 
123
                wrapped = textwrap.fill(l, initial_indent='',
 
124
                                        subsequent_indent=30*' ')
 
125
                option_str = option_str + wrapped + '\n'       
126
126
 
127
127
    aliases_str = ""
128
128
    if cmd.aliases: