pretty good command-line option parser
Project description
Cmdopt.py is command-line option parser for Python.
Example:
import sys, cmdopt ## create parser parser = cmdopt.Parser() ## define options parser.option("-h, --help", "show help") parser.option("-f, --file=FILE", "read file") parser.option("-i, --indent=N", "indent width")\ .validation(lambda val: not val.isdigit() and "integer required.")\ .action(lambda val, opts: setattr(opts, 'indent', int(val))) ## parse args args = sys.argv[1:] opts = parser.parse(args) # may raise cmdopt.ParseError if opts.help: print(parser.help()) # or parser.help(width=15, indent=" ")
Features:
Validator
Handler
Help message
Multiple option
See README for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Cmdopt-0.2.0.tar.gz
(9.7 kB
view hashes)
Built Distributions
Cmdopt-0.2.0-py3.2.egg
(7.0 kB
view hashes)
Cmdopt-0.2.0-py3.1.egg
(7.0 kB
view hashes)
Cmdopt-0.2.0-py3.0.egg
(7.0 kB
view hashes)
Cmdopt-0.2.0-py2.7.egg
(7.0 kB
view hashes)
Cmdopt-0.2.0-py2.6.egg
(7.0 kB
view hashes)
Cmdopt-0.2.0-py2.5.egg
(7.0 kB
view hashes)
Cmdopt-0.2.0-py2.4.egg
(7.1 kB
view hashes)