[Twisted-Python] twisted.python.usage.Options Questions

Justin Johnson justinjohnson at fastmail.fm
Fri May 16 14:41:35 EDT 2003

> > 1)  Passing in the --help option displays usage info the way I'd want it,
> > grabbing __doc__ from the top of the file and also displaying info about
> > my subcommands.  
> > 
> > [snip output]
> > 
> > Is there a way to do that?
>   Hmm, I don't believe so.  Usage could probably be patched to print
> something slightly different for options with subcommands.

I was thinking it would make sense to grab the doc from the class that
handles the options for the particular subcommand, since it is the only
class/function that we already know the name of and that is already
associated with the subcommand.

class RmvobOptions(usage.Options):
	"""Remove a VOB, yada yada yada <<< Here's my doc to go into usage
	optParameters = [
		['vobs', 'v', None, "Comma-delimitted list of VOBs to remove"],
		['original', 'o', None, "Site to remove VOBs from"],
	def postOptions(self):
		for opt in ["vobs","original"]:
			if not self[opt]:
				raise usage.UsageError, "--vobs and --original are required."

Does that make sense?  Is that something you can do, or should I get
familiar with the code and submit a patch?
Thanks for your other suggestions as well.


More information about the Twisted-Python mailing list