[Python-checkins] CVS: python/dist/src/Doc/lib libcmd.tex,1.9,1.10

Martin v. L?wis loewis@users.sourceforge.net
Sat, 28 Jul 2001 07:44:05 -0700


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

Modified Files:
	libcmd.tex 
Log Message:
Patch #416224: add readline completion to cmd.Cmd.


Index: libcmd.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcmd.tex,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** libcmd.tex	2001/07/12 02:09:51	1.9
--- libcmd.tex	2001/07/28 14:44:03	1.10
***************
*** 12,16 ****
  later be wrapped in a more sophisticated interface.
  
! \begin{classdesc}{Cmd}{}
  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}}
  A \class{Cmd} instance or subclass instance is a line-oriented
  interpreter framework.  There is no good reason to instantiate
***************
*** 18,21 ****
--- 18,27 ----
  interpreter class you define yourself in order to inherit
  \class{Cmd}'s methods and encapsulate action methods.
+ 
+ The optional argument is the \refmodule{readline} name of a completion
+ key; it defaults to \code{``tab''}. If \var{completekey} is not
+ \code{None} and \module{readline} is available, command completion is
+ done automatically.
+ 
  \end{classdesc}
  
***************
*** 48,51 ****
--- 54,67 ----
  method \method{do_shell} (if such a method is defined).
  
+ If completion is enabled, completing commands will be done
+ automatically, and completing of commands args is done by calling
+ \method{complete_foo()} with arguments \samp{text}, \samp{line},
+ \samp{begidx}, \samp{endidx}.  \samp{text} is string we are matching
+ against, all returned matches must begin with it.  \samp{line} is the
+ current input line (lstripped), \samp{begidx} and \samp{endidx} are
+ the beginning and end indexes of the text being matched, which could
+ be used to provide different completion depending upon which position
+ the argument is in.
+ 
  All subclasses of \class{Cmd} inherit a predefined \method{do_help}.
  This method, called with an argument \code{bar}, invokes the
***************
*** 71,74 ****
--- 87,96 ----
  recognized. If this method is not overridden, it prints an
  error message and returns.
+ \end{methoddesc}
+ 
+ \begin{methoddesc}{completedefault}{text, line, begidx, endidx}
+ Method called to complete an input line when no command-specific
+ \code{complete_} method is available. By default, it returns an
+ empty list.
  \end{methoddesc}