314
|
1 .. cmd2 documentation master file, created by
|
|
2 sphinx-quickstart on Wed Feb 10 12:05:28 2010.
|
|
3 You can adapt this file completely to your liking, but it should at least
|
|
4 contain the root `toctree` directive.
|
|
5
|
358
|
6 cmd2
|
|
7 ====
|
|
8
|
359
|
9 A python package for building powerful command-line interpreter (CLI)
|
|
10 programs. Extends the Python Standard Library's cmd_ package.
|
|
11
|
364
|
12
|
|
13 .. _`cmd2 project page`: http://www.assembla.com/wiki/show/python-cmd2
|
|
14 .. _`project bug tracker`: http://trac-hg.assembla.com/python-cmd2/report/1
|
|
15
|
359
|
16 .. _cmd: http://docs.python.org/library/cmd.html#module-cmd
|
|
17
|
324
|
18 The basic use of ``cmd2`` is identical to that of cmd_.
|
|
19
|
|
20 1. Create a subclass of ``cmd2.Cmd``. Define attributes and
|
|
21 ``do_*`` methods to control its behavior. Throughout this documentation,
|
|
22 we will assume that you are naming your subclass ``App``::
|
|
23
|
|
24 from cmd2 import Cmd
|
|
25 class App(Cmd):
|
|
26 # customized attributes and methods here
|
|
27
|
|
28 2. Instantiate ``App`` and start the command loop::
|
|
29
|
|
30 app = App()
|
|
31 app.cmdloop()
|
332
|
32
|
364
|
33 Resources
|
|
34 ---------
|
|
35
|
|
36 * cmd_
|
|
37 * `project bug tracker`_
|
|
38 * `cmd2 project page`_
|
385
|
39 * `PyCon 2010 presentation <http://us.pycon.org/2010/conference/talks/#proposal_link_153>`_,
|
|
40 *Easy Command-Line Applications with cmd and cmd2*:
|
|
41 `slides <http://packages.python.org/cmd2/>`_,
|
|
42 `video <http://python.mirocommunity.com/video/1533/easy-command-line-applications>`_
|
364
|
43
|
332
|
44 These docs will refer to ``App`` as your ``cmd2.Cmd``
|
|
45 subclass, and ``app`` as an instance of ``App``. Of
|
|
46 course, in your program, you may name them whatever
|
|
47 you want.
|
324
|
48
|
314
|
49 Contents:
|
|
50
|
|
51 .. toctree::
|
|
52 :maxdepth: 2
|
|
53
|
|
54 overview
|
|
55 example
|
|
56 freefeatures
|
315
|
57 settingchanges
|
|
58 unfreefeatures
|
385
|
59 alternatives
|
314
|
60
|
|
61 Indices and tables
|
|
62 ==================
|
|
63
|
|
64 * :ref:`genindex`
|
|
65 * :ref:`modindex`
|
|
66 * :ref:`search`
|
|
67
|