资 源 简 介
Note: This project has been moved to trentm/cmdln on GitHub.
cmdln.py fixes some of the design flaws in cmd.py and takes advantage of new Python stdlib modules (e.g. optparse) so that it is more useful (and convenient) for implementing command-line scripts/shells.
The main differences are:
Instead of passing a command line to subcommand handlers, already parsed options and an args list are provided. This is much more convenient when the complexity of commands grows to have options, arguments with spaces, etc.
By default the help for a subcommand is the associated method"s docstring. Default help output is also much nicer and some template vars can be used to automatically fill in some details.
Defining command aliases is easy (using a new decorator).
A .main() method is provided to make using your Cmdln subclass a little cleaner.
The error han