Ticket #2231 defect closed duplicate
t.p.usage documents multicharacter shortcuts for subcommands but does not support them.
| Reported by: | dreid | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | core | Keywords: | |
| Cc: | Branch: | ||
| Author: | Launchpad Bug: |
Description
From http://twistedmatrix.com/documents/current/api/twisted.python.usage.Options.html:
subCommands is a list of 4-tuples of (command name, command shortcut, parser class, documentation). If the first non-option argument found is one of the given command names, an instance of the given parser class is instantiated and given the remainder of the arguments to parse and self.opts[command] is set to the command name. For example:
| subCommands = [ | ['inquisition', 'inquest', InquisitionOptions, 'Perform an inquisition'], | ['holyquest', 'quest', HolyQuestOptions, 'Embark upon a holy quest'] | ]
However actually using a multicharacter command shortcut causes a typeerror to be raised when issuing --help.
dreid:~> python projects/bs.py --help
Traceback (most recent call last):
File "projects/bs.py", line 12, in ?
Options().parseOptions()
File "/private/Network/Servers/harris/Volumes/veedu/dreid/projects/Twisted/trunk/twisted/python/usage.py", line 177, in parseOptions
self.__dispatch[optMangled](optMangled, arg)
File "/private/Network/Servers/harris/Volumes/veedu/dreid/projects/Twisted/trunk/twisted/python/usage.py", line 337, in <lambda>
fn = lambda name, value=None, m=method: m()
File "/private/Network/Servers/harris/Volumes/veedu/dreid/projects/Twisted/trunk/twisted/python/usage.py", line 141, in opt_help
print self.__str__()
File "/private/Network/Servers/harris/Volumes/veedu/dreid/projects/Twisted/trunk/twisted/python/usage.py", line 373, in __str__
return self.getSynopsis() + '\n' + self.getUsage(width=None)
File "/private/Network/Servers/harris/Volumes/veedu/dreid/projects/Twisted/trunk/twisted/python/usage.py", line 415, in getUsage
chunks = docMakeChunks(cmdDicts, width)
File "/private/Network/Servers/harris/Volumes/veedu/dreid/projects/Twisted/trunk/twisted/python/usage.py", line 517, in docMakeChunks
short = "-%c" % (opt['short'],)
TypeError: %c requires int or char
zsh: exit 1 python projects/bs.py --help
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

