(nothing yet)
Added support for Python 3 (test suite fully passing). Thanks Stuart Axon (https://github.com/stuaxo) for some of this work!
- [#30, first commit only] Allow dynamic setting of
self.prompt
and have it update. By https://github.com/hfeeki.
(LONG hiatus from working on this module.)
-
Change
self.postoptparse()
hook handling to use the retval value. If it is none-zero (or non-None), thenCmdln.main()
processing exits. This allows a Cmdln subclass to issue a starter command.For example, the following "Foo" shell will start by running the "init" subcmd. If that fails (returns non-zero), then
foo.main()
will return right away, instead of entering the REPL loop.class Foo(cmdln.Cmdln): def postoptparse(self): ... return self.cmd(['init']) def do_init(self, subcmd, opts): ... foo = Foo() foo.main()
-
Fix tab-completion on Mac with Python builds that build against editline where
readline.parse_and_bind
have different syntax.
- Issue 3: Raise upper bound width for left column in "Commands" and "help topics" lists in help output to 30. Also fix buglet in that column formatting.
- Issue 7: add
man_sections_from_cmdln(...)
for generating decent man page content automatically from aCmdln
subclass instance. See ManPageGeneration for an overview.
- Stop using
string.whitespace
because it can be an 8-bit string with non-ASCII chars in it, leading to potentialUnicodeDecodeError
s. See Komodo Bug 81316.
- Some Python 2.6-ification. No functional change.
- Issue 1: fix readline-based completion and history (from Joshua Gallagher).
- Experimental automatic bash completion support. See r8 for details: svn diff -r7:8 http://cmdln.googlecode.com/svn/trunk/cmdln.py
- Some minor improvements to line2argv processing (r7).
- Fix "${help_list}" layout problems and more closely follow optparse option list help output (r4).
- Moved project to Google Code (http://code.google.com/p/cmdln) for Subversion there and for the issue tracker.
- Experimental Bash completion integration. See "bash completion support" section in cmdln.py for details.
- [backward incompat]
Cmdln.main()
no longer takes anoptparser
argument. Top-level option parsing has been changed so that top-level options for aCmdln
subclass can more naturally be defined and handled on the class definition. Changes:Cmdln.main()
callsself.get_optparser
to get an option handler. Subclasses should overload this method for custom top-level options.- After option parsing, but before sub-command handling, the
self.postoptparse()
hook is called.
- Add a
version
attribute onCmdln
subclasses. If set, the default top-level option parser will have a--version
attribute. - [backward incompat] Simplify the StopProcessing/opts.stop handling for option handling in subcommands. The "opts" argument to "do_*" sub-command functions will no longer have a "stop" value. StopProcessing is now called StopOptionProcessing. This shouldn't affect simple usage of cmdln.py.
- Fix a bug where errors with passing an incorrect number of args to functions in do_foo() implementations would be masked.
- Remove the implicit prefixing of a command's help string with "${cmd_name}: ". This can be surprising for the case of a "help_FOO" function without an associated "cmd_FOO" function.
- Work on getting started docs.
- Improve the ${command_list} output to better handle long command names.
- Add ${cmd_usage} template var: infering a usage from the command handler signature.
- Add ${option_list} template var for the option table for the whole Cmdln class and add this to the default help output.
- First version at which I started stabilizing it for public release.
I've been batting around modules to improve on
cmd.py
for a long time -- variously calledtm/cmd.py
, 'cmd2.py', 'tmCmd.py', 'linecmd.py', 'argvcmd.py', etc.