336
|
1 ============================
|
|
2 Alternatives to cmd and cmd2
|
|
3 ============================
|
|
4
|
|
5 For programs that do not interact with the user in a continuous loop -
|
|
6 programs that simply accept a set of arguments from the command line, return
|
|
7 results, and do not keep the user within the program's environment - all
|
|
8 you need are sys_\ .argv (the command-line arguments) and optparse_
|
|
9 (for parsing UNIX-style options and flags).
|
|
10
|
|
11 .. _optparse: http://docs.python.org/library/optparse.html#module-optparse
|
|
12
|
|
13 .. _sys: http://docs.python.org/library/sys.html#module-sys
|
|
14
|
|
15 .. _curses: http://docs.python.org/library/curses.html#module-curses
|
|
16
|
|
17 .. _cmd: http://docs.python.org/library/cmd.html#module-cmd
|
|
18
|
|
19 The curses_ module produces applications that interact via a plaintext
|
|
20 terminal window, but are not limited to simple text input and output;
|
|
21 they can paint the screen with options that are selected from using the
|
|
22 cursor keys. However, programming a curses_-based application is not as
|
|
23 straightforward as using cmd_.
|
|
24
|
|
25 Several packages in PyPI enable interactive command-line applications
|
|
26 approximately similar in concept to cmd_ applications. None of them
|
|
27 share cmd2's close ties to cmd, but they may be worth investigating
|
|
28 nonetheless.
|
|
29
|
|
30 * CmdLoop_
|
|
31 * cly_
|
|
32 * CmDO_ (As of Feb. 2010, webpage is missing.)
|
|
33 * pycopia-CLI_
|
|
34
|
|
35 cmdln_, another package in PyPI, is an extension to cmd_ and, though it
|
|
36 doesn't retain full cmd_ compatibility, shares its basic structure with
|
|
37 cmd_.
|
|
38
|
|
39 .. _cmdln_ http://pypi.python.org/pypi/cmdln
|
|
40
|
|
41 .. _CmdLoop: http://pypi.python.org/pypi/CmdLoop
|
|
42
|
|
43 .. _cly: http://pypi.python.org/pypi/cly
|
|
44
|
|
45 .. _CmDO: http://pypi.python.org/pypi/CmDO/0.7
|
|
46
|
|
47 .. _pycopia-CLI: http://pypi.python.org/pypi/pycopia-CLI/1.0
|
|
48
|
|
49 I've found several alternatives to cmd in the Cheese Shop - CmdLoop, cly, CMdO, and pycopia. cly looks wonderful, but I haven't been able to get it working under Windows, and that's a show-stopper for many potential sqlpython users. In any case, none of the alternatives are based on cmd - they're written from scratch, which means that a cmd-based app would need complete rewriting to use them. I like sticking close to the Standard Library whenever possible. cmd2 lets you do that.
|
|
50
|