annotate docs/alternatives.rst @ 375:6cc12ad6e616

options in pirate8.py slide
author cat@eee
date Sat, 20 Feb 2010 09:26:33 -0500
parents 8aa71e8f1064
children 52ab96d4f179
rev   line source
336
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
1 ============================
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
2 Alternatives to cmd and cmd2
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
3 ============================
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
4
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
5 For programs that do not interact with the user in a continuous loop -
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
6 programs that simply accept a set of arguments from the command line, return
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
7 results, and do not keep the user within the program's environment - all
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
8 you need are sys_\ .argv (the command-line arguments) and optparse_
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
9 (for parsing UNIX-style options and flags).
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
10
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
11 .. _optparse: http://docs.python.org/library/optparse.html#module-optparse
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
12
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
13 .. _sys: http://docs.python.org/library/sys.html#module-sys
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
14
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
15 .. _curses: http://docs.python.org/library/curses.html#module-curses
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
16
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
17 .. _cmd: http://docs.python.org/library/cmd.html#module-cmd
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
18
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
19 The curses_ module produces applications that interact via a plaintext
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
20 terminal window, but are not limited to simple text input and output;
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
21 they can paint the screen with options that are selected from using the
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
22 cursor keys. However, programming a curses_-based application is not as
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
23 straightforward as using cmd_.
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
24
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
25 Several packages in PyPI enable interactive command-line applications
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
26 approximately similar in concept to cmd_ applications. None of them
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
27 share cmd2's close ties to cmd, but they may be worth investigating
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
28 nonetheless.
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
29
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
30 * CmdLoop_
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
31 * cly_
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
32 * CmDO_ (As of Feb. 2010, webpage is missing.)
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
33 * pycopia-CLI_
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
34
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
35 cmdln_, another package in PyPI, is an extension to cmd_ and, though it
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
36 doesn't retain full cmd_ compatibility, shares its basic structure with
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
37 cmd_.
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
38
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
39 .. _cmdln_ http://pypi.python.org/pypi/cmdln
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
40
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
41 .. _CmdLoop: http://pypi.python.org/pypi/CmdLoop
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
42
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
43 .. _cly: http://pypi.python.org/pypi/cly
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
44
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
45 .. _CmDO: http://pypi.python.org/pypi/CmDO/0.7
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
46
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
47 .. _pycopia-CLI: http://pypi.python.org/pypi/pycopia-CLI/1.0
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
48
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
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.
8aa71e8f1064 alternatives
catherine@Drou
parents:
diff changeset
50