pash.shell

Home to the pash shell and its default functions.

class pash.shell.Shell(prompt: str = '$ ', interrupt_end: bool = False, unknown_cmd: Callable[[pash.command.CascCommand, str], None] = <function _def_unknown_cmd>, sep: str = '\s(?:(?=(?:[^"]*"[^"]*")+[^"]*$)|(?=[^"]*$))')

The class representing the actual shell the user interacts with.

prompt

The shell’s prompt (the string prefixing the user’s input; e.g.: ‘bernd@raspberrypi: ‘).

Type:str
__interrupt_end

Whether or not the shell should terminate when a KeyboardInterrupt exception (Ctrl+C) arises.

Type:bool
__exited

Whether or not the shell has terminated yet.

Type:bool
helpc

The help command. It takes care of calls to ‘help’ and ‘?’.

Type:CascCommand
exit()

Terminates the shell. (__exited = True)

add_cmd(cmd)

Adds a command the terminal will respond to.

prompt_until_exit()

Keep asking the user for input and handling those commands, until the shell terminates.

print_help()

Print all possible commands and their short help summary.

add_cmd(cmd: pash.command.Command) → None

Adds a command to the shell.

Parameters:cmd (Command) – The command to-be-added.
exit() → None

Terminates the shell

print_help() → None

Prints all available commands and their short help summaries.

prompt_until_exit() → None

Keeps prompting the user for more input (commands) until the shell terminates.