Command Line interface in pYthon
Overview
CLY is a Python module for simplifying the creation of interactive shells. Kind of like the builtin cmd module on steroids.
It has the following features:
- Tab completion of all commands.
- Contextual help.
- Extensible grammar - you can define your own commands with full dynamic completion, contextual help, and so on.
- Simple. Grammars are constructed from objects using a convenient function-like syntax.
- Grammars can also be defined in XML, facilitating a more data-driven approach.
- Flexible command grouping and ordering.
- Grammar parser, including completion and help enumeration, can be used independently of the readline-based shell. This allows CLY's parser to be used in other environments (think web-based shell ;))
- Lots of other cool stuff.
Bugs?
Please check existing bugs first in case your issue has already been reported.
If it hasn't proceed create a new ticket.
Installation
Normal Python package installation procedures apply:
# python setup.py build # python setup.py build_ext -i # python setup.py test # python setup.py install
This will compile, test and install CLY and the CLY Readline extensions.
Documentation
I suggest talking a walk through the tutorial first, then refer to the documentation index for more information.
Download
Latest stable versions can be downloaded from the Cheese Shop.
Download a ZIP of trunk from here, browse the code, or check out the source with Subversion:
svn co http://swapoff.org/svn/cly/trunk cly
Change Log
[555] by athomas on 06/15/08 05:49:18
Whoops.
[554] by athomas on 06/15/08 05:17:39
Implemented reentrant input drivers. This allows multiple grammars to be used at the same time. Fixes #67.
[553] by athomas on 06/15/08 05:17:19
Refactored InputDriver so implementations are cleanly separated.
[552] by athomas on 06/15/08 05:17:05
Cleaned up the rather confusing user_context/with_context/with_user_context:
- To pass user data into the parser use data=.... This will be available as the data member of the parse Context.
- Specifying with_context=True to nodes will make the Context available to callbacks as the first argument.
[551] by athomas on 06/10/08 21:04:24
Added Conditional node type, fixes #58.
[550] by athomas on 06/10/08 10:57:29
Remove redundant use of Node.parser.
