friendlyshell.base_shell module¶
Common shell interaction logic shared between different shells
-
class
friendlyshell.base_shell.
BaseShell
(*args, **kwargs)[source]¶ Bases:
object
Common base class for all Friendly Shells
Defines basic IO and interactive shell logic common to all Friendly Shells
-
static
alias_native_shell
()[source]¶ Gets the shorthand character for the ‘native_shell’ command
Return type: str
-
static
debug
(message, *args, **_kwargs)[source]¶ Displays an internal-use-only debug message to verbose log file
Default implementation hides all debug output. Use a logging mixin class to customize this behavior.
See
friendlyshell.basic_logger_mixin.BasicLoggerMixin
for examples.Parameters: message (str) – text to be displayed
-
static
error
(message, *args, **_kwargs)[source]¶ Displays a critical error message to the default output stream
Default implementation just directs output to stdout. Use a logging mixin class to customize this behavior.
See
friendlyshell.basic_logger_mixin.BasicLoggerMixin
for examples.Parameters: message (str) – text to be displayed
-
static
info
(message, *args, **_kwargs)[source]¶ Displays an info message to the default output stream
Default implementation just directs output to stdout. Use a logging mixin class to customize this behavior.
See
friendlyshell.basic_logger_mixin.BasicLoggerMixin
for examples.Parameters: message (str) – text to be displayed
-
run
(*_args, **kwargs)[source]¶ Main entry point function that launches our command line interpreter
This method will wait for input to be given via the command line, and process each command provided until a request to terminate the shell is given.
Parameters: - input_stream – optional Python input stream object where commands should be loaded
from. Typically this will be a file-like object containing commands
to be run, but any input stream object should work.
If not provided, input will be read from stdin using
input()
- parent – Optional parent shell which owns this shell. If none provided this shell is assumed to be a parent or first level shell session with no ancestry
- input_stream – optional Python input stream object where commands should be loaded
from. Typically this will be a file-like object containing commands
to be run, but any input stream object should work.
If not provided, input will be read from stdin using
-
run_subshell
(subshell)[source]¶ Launches a child process for another shell under this one
Parameters: subshell – the new Friendly Shell to be launched
-
static
warning
(message, *args, **_kwargs)[source]¶ Displays a non-critical warning message to the default output stream
Default implementation just directs output to stdout. Use a logging mixin class to customize this behavior.
See
friendlyshell.basic_logger_mixin.BasicLoggerMixin
for examples.param str message: text to be displayed
-
static