betterSIS BetterSIS Code Documentation

BETTERSIS: The modern shell for SIS

class bettersis.bettersis.Bettersis[source]

Shows bettersis’ interactive shell.

After the creation of an instance a SIS process is ready to receive commands.

Note

The SIS process is started and controlled by the siswrapper. library

Shared variables:

  • res: dictionary with results of the start operation (success, errors, stdout)

  • sis: connection to SIS’s process

  • lastcmd: contains the last command

  • lastcmd_success: boolean that is set to True if the last command execution was successfull

  • history_file_path: path to the history file (used when BSIS_HISTORY_ENABLED environment variable is “true”)

bottom_toolbar()[source]

Returns message to show inside the toolbar at the bottom.

Return str toolbar

toolbar message

bsiscmd_cd(t_path)[source]

Changes current directory to the <t_path> directory.

Parameters

t_path (str) – new working path

bsiscmd_edit(t_path)[source]

Opens the <t_path> file with the text editor.

Parameters

t_path (str) – path of the file to open.

bsiscmd_ls(t_path)[source]

Lists files and directories inside the <t_path> folder.

Parameters

t_path (str) – path in which to execute the “ls” command

main()[source]

Starts the interactive shell.

manage_bsis_command(t_command)[source]

Executes the <t_command> command betterSIS.

Parameters

t_command (str) – custom betterSIS command to execute

manage_command(t_command)[source]

Executes the <t_command> command using SIS.

Parameters

t_command (str) – command to execute using SIS

manage_history_file()[source]

Manages the history file size and usage.

Checks if the BSIS_HISTORY_ENABLED environment variable is set to true: if is is set to true the function returns True and betterSIS will use the history file, else the history will expire at the end of the session.

Then, if a history file already exists, checks the BSIS_HISTORY_SIZELIMIT environment: if the value is a number it is used as a size limit, else the limit is the default one (0.1 MB)

manage_multiple_commands(t_commands)[source]

Executes the command(s) <t_commands>.

Parameters

t_commands (str) – command(s) to execute (using SIS or special bSIS commands)

show_msg_on_startup()[source]

Shows the message at the shell startup.

bettersis.bettersis.main()[source]

Main function: sets up the logger, calls betterSIS and manages exceptions

bettersis.bettersis.show_ghissues_msg(t_err)[source]

Shows the “please, report this to the developer” message. :param Exception t_err: error from which to extract the traceback