Package pyraf :: Module pycmdline :: Class CmdConsole
[hide private]
[frames] | no frames]

Class CmdConsole

source code


Base class for command console.

Similar to InteractiveConsole, but provides local prompt control and hook for simple non-Python command processing.

Instance Methods [hide private]
 
__init__(self, locals=None, filename='<console>', cmddict=None, prompt1='>>> ', prompt2='... ', cmdchars=('a-zA-Z_.', '0-9'))
Constructor.
source code
 
addHistory(self, line)
Append a line to history
source code
 
printHistory(self, n=20)
Print last n lines of history
source code
 
interact(self, banner=None)
Emulate the interactive Python console, with extra commands.
source code
 
cmd(self, line)
Check for and execute commands from dictionary.
source code
 
default(self, cmd, line, i)
Hook to handle other commands (this version does nothing)
source code

Inherited from code.InteractiveConsole: push, raw_input, resetbuffer

Inherited from code.InteractiveInterpreter: runcode, runsource, showsyntaxerror, showtraceback, write

Method Details [hide private]

__init__(self, locals=None, filename='<console>', cmddict=None, prompt1='>>> ', prompt2='... ', cmdchars=('a-zA-Z_.', '0-9'))
(Constructor)

source code 

Constructor.

The optional locals argument will be passed to the InteractiveInterpreter base class.

The optional filename argument should specify the (file)name of the input stream; it will show up in tracebacks.

Overrides: code.InteractiveInterpreter.__init__
(inherited documentation)

interact(self, banner=None)

source code 

Emulate the interactive Python console, with extra commands.

Also is modified so it does not catch EOFErrors.

Overrides: code.InteractiveConsole.interact