Movatterモバイル変換


[0]ホーム

URL:


Up one LevelPython Library ReferenceContentsModule IndexIndex

22.1cmd -- Support for line-oriented command interpreters

TheCmd class provides a simple framework for writingline-oriented command interpreters. These are often useful fortest harnesses, administrative tools, and prototypes that willlater be wrapped in a more sophisticated interface.

class Cmd([completekey[, stdin[, stdout]]])
ACmd instance or subclass instance is a line-orientedinterpreter framework. There is no good reason to instantiateCmd itself; rather, it's useful as a superclass of aninterpreter class you define yourself in order to inheritCmd's methods and encapsulate action methods.

The optional argumentcompletekey is thereadline nameof a completion key; it defaults toTab. Ifcompletekey isnotNone andreadline is available, command completionis done automatically.

The optional argumentsstdin andstdout specify the input and output file objects that the Cmd instance or subclass instance will use for input and output. If not specified, theywill default tosys.stdin andsys.stdout.

Changed in version 2.3:Thestdin andstdout parameters were added.



Subsections


Up one LevelPython Library ReferenceContentsModule IndexIndex

Release 2.5.2, documentation updated on 21st February, 2008.
SeeAbout this document... for information on suggesting changes.
[8]ページ先頭

©2009-2025 Movatter.jp