4. pypsi.shell - Pypsi Shell¶
-
class
pypsi.shell.
Shell
(shell_name='pypsi', width=79, exit_rc=-1024, ctx=None, features=None)[source]¶ Bases:
object
The command line interface that the user interacts with. All shell’s need to inherit this base class.
Subclasses need to call the Shell constructor to properly initialize it.
Parameters: - shell_name (str) – the name of the shell; used in error messages
- exit_rc (int) – the exit return code that is returned from a command when the shell needs to end execution
- ctx (pypsi.namespace.Namespace) – the base context
-
create_pipe_threads
(pipe)[source]¶ Given a pipe (list of
CommandInvocation
objects) create a thread to execute for each invocation.Returns tuple: a tuple containing the list of threads ( CommandThread
) and the last invocation’s stdout stream.
-
execute
(raw)[source]¶ Parse and execute a statement.
Parameters: - raw (str) – the raw command line to parse.
- input (function) – a function that returns a string, overrides default input function (stdin).
Returns int: the return code of the statement.