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
|
|
12 .. _cmd: http://docs.python.org/library/cmd.html#module-cmd
|
|
13
|
|
14 `cmd2 project page`_: http://docs.python.org/library/cmd.html#module-cmd
|
358
|
15
|
|
16 `project bug tracker`_
|
|
17
|
|
18 .. _`cmd2 Project page`: http://www.assembla.com/wiki/show/python-cmd2
|
|
19 .. _`project bug tracker`: http://trac-hg.assembla.com/python-cmd2/report/1
|
314
|
20
|
324
|
21 The basic use of ``cmd2`` is identical to that of cmd_.
|
|
22
|
|
23 1. Create a subclass of ``cmd2.Cmd``. Define attributes and
|
|
24 ``do_*`` methods to control its behavior. Throughout this documentation,
|
|
25 we will assume that you are naming your subclass ``App``::
|
|
26
|
|
27 from cmd2 import Cmd
|
|
28 class App(Cmd):
|
|
29 # customized attributes and methods here
|
|
30
|
|
31 2. Instantiate ``App`` and start the command loop::
|
|
32
|
|
33 app = App()
|
|
34 app.cmdloop()
|
332
|
35
|
|
36 These docs will refer to ``App`` as your ``cmd2.Cmd``
|
|
37 subclass, and ``app`` as an instance of ``App``. Of
|
|
38 course, in your program, you may name them whatever
|
|
39 you want.
|
324
|
40
|
314
|
41 Contents:
|
|
42
|
|
43 .. toctree::
|
|
44 :maxdepth: 2
|
|
45
|
|
46 overview
|
|
47 example
|
|
48 freefeatures
|
315
|
49 settingchanges
|
|
50 unfreefeatures
|
314
|
51
|
|
52 Indices and tables
|
|
53 ==================
|
|
54
|
|
55 * :ref:`genindex`
|
|
56 * :ref:`modindex`
|
|
57 * :ref:`search`
|
|
58
|