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
|
364
|
18 .. _`PyCon 2010 presentation`: http://catherinedevlin.pythoneers.com/presentations/cmd_cmd2/pycon2010.html
|
314
|
19
|
324
|
20 The basic use of ``cmd2`` is identical to that of cmd_.
|
|
21
|
|
22 1. Create a subclass of ``cmd2.Cmd``. Define attributes and
|
|
23 ``do_*`` methods to control its behavior. Throughout this documentation,
|
|
24 we will assume that you are naming your subclass ``App``::
|
|
25
|
|
26 from cmd2 import Cmd
|
|
27 class App(Cmd):
|
|
28 # customized attributes and methods here
|
|
29
|
|
30 2. Instantiate ``App`` and start the command loop::
|
|
31
|
|
32 app = App()
|
|
33 app.cmdloop()
|
332
|
34
|
364
|
35 Resources
|
|
36 ---------
|
|
37
|
|
38 * cmd_
|
|
39 * `project bug tracker`_
|
|
40 * `cmd2 project page`_
|
366
|
41 * `PyCon 2010 presentation`_: Easy Command-Line Applications with cmd and cmd2
|
364
|
42
|
332
|
43 These docs will refer to ``App`` as your ``cmd2.Cmd``
|
|
44 subclass, and ``app`` as an instance of ``App``. Of
|
|
45 course, in your program, you may name them whatever
|
|
46 you want.
|
324
|
47
|
314
|
48 Contents:
|
|
49
|
|
50 .. toctree::
|
|
51 :maxdepth: 2
|
|
52
|
|
53 overview
|
|
54 example
|
|
55 freefeatures
|
315
|
56 settingchanges
|
|
57 unfreefeatures
|
314
|
58
|
|
59 Indices and tables
|
|
60 ==================
|
|
61
|
|
62 * :ref:`genindex`
|
|
63 * :ref:`modindex`
|
|
64 * :ref:`search`
|
|
65
|