[Python-checkins] python/dist/src/Doc/lib libcmd.tex,1.12,1.13

anthonybaxter@users.sourceforge.net anthonybaxter@users.sourceforge.net
Wed, 05 Feb 2003 17:45:14 -0800


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv23648/Doc/lib

Modified Files:
	libcmd.tex 
Log Message:
Updated version of [ 558544 ] cmd.py: add instance-specific stdin/out

This patch adds stdin, stdout as optional arguments to the cmd.Cmd
constructor (defaulting to sys.stdin, sys.stdout), and changes the Cmd
methods throughout to use self.stdout.write() and self.stdin.foo for
output and input. This allows much greater flexibility for using cmd -
for instance, hooking it into a telnet server.

Patch for library module and for documentation.



Index: libcmd.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcmd.tex,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** libcmd.tex	27 Dec 2001 05:10:18 -0000	1.12
--- libcmd.tex	6 Feb 2003 01:45:11 -0000	1.13
***************
*** 12,16 ****
  later be wrapped in a more sophisticated interface.
  
! \begin{classdesc}{Cmd}{\optional{completekey}}
  A \class{Cmd} instance or subclass instance is a line-oriented
  interpreter framework.  There is no good reason to instantiate
--- 12,16 ----
  later be wrapped in a more sophisticated interface.
  
! \begin{classdesc}{Cmd}{\optional{completekey},\optional{stdin},\optional{stdout}}
  A \class{Cmd} instance or subclass instance is a line-oriented
  interpreter framework.  There is no good reason to instantiate
***************
*** 19,26 ****
  \class{Cmd}'s methods and encapsulate action methods.
  
! The optional argument is the \refmodule{readline} name of a completion
! key; it defaults to \kbd{Tab}. If \var{completekey} is not \code{None}
! and \module{readline} is available, command completion is done
! automatically.
  \end{classdesc}
  
--- 19,32 ----
  \class{Cmd}'s methods and encapsulate action methods.
  
! The optional argument \var{completekey} is the \refmodule{readline} name
! of a completion key; it defaults to \kbd{Tab}. If \var{completekey} is
! not \code{None} and \module{readline} is available, command completion
! is done automatically.
! 
! The optional arguments \var{stdin} and \var{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 \var{sys.stdin} and \var{sys.stdout}.
! 
  \end{classdesc}