ASPN ActiveState Programmer Network
  ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups | Web Services
SEARCH

Reference
ActivePython 2.5
Python Documentation
Library Reference
22. Program Frameworks
22.1 cmd -- Support for line-oriented command interpreters
22.1.1 Cmd Objects
22.2 shlex -- Simple lexical analysis

MyASPN >> Reference >> ActivePython 2.5 >> Python Documentation >> Library Reference >> 22. Program Frameworks
ActivePython 2.5 documentation

22.1 cmd -- Support for line-oriented command interpreters

The Cmd class provides a simple framework for writing line-oriented command interpreters. These are often useful for test harnesses, administrative tools, and prototypes that will later be wrapped in a more sophisticated interface.

class Cmd( [completekey[, stdin[, stdout]]])
A Cmd instance or subclass instance is a line-oriented interpreter framework. There is no good reason to instantiate Cmd itself; rather, it's useful as a superclass of an interpreter class you define yourself in order to inherit Cmd's methods and encapsulate action methods.

The optional argument completekey is the readline name of a completion key; it defaults to Tab. If completekey is not None and readline is available, command completion is done automatically.

The optional arguments stdin and stdout specify the input and output file objects that the Cmd instance or subclass instance will use for input and output. If not specified, they will default to sys.stdin and sys.stdout.

Changed in version 2.3: The stdin and stdout parameters were added.



See About this document... for information on suggesting changes.

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState 2004 All rights reserved