Ideas for a module to process command line arguments

Alice Bevan–McGregor alice at gothcandy.com
Tue Jan 11 02:25:55 EST 2011


On 2011-01-10 21:18:41 -0800, Sohail said:

> Hey, every body has their own favorite method/ways to process command 
> line arguments. I've worked on a little CPython extension to handle 
> command line arguments may be you'll find it interesting and useful....

Even I've implemented my own way to handle command-line scripts, marrow.script:

	https://github.com/pulp/marrow.script

The idea with mine that you write a Python function... and that's it.  
The latest version has experimental support for class-based 
"subcommand" dispatch, but it needs work, needs to be updated to 
support sub-sub commands, and the help text generator needs to be 
overhauled to support classes properly.

The argument list, typecasting, etc. is built from the argspec.  Help 
text is pulled from the docstring.  Decorators are provided to override 
short names, define explicit callbacks or typecasting functions, etc.

I got tired of using PasteScript and OptParse.  Mostly OptParse, actually.  :/

	- Alice.





More information about the Python-list mailing list