stilts_wrapper.shell_helper

CatMatcher.shell_helper.execute_shell_script(destination_path, name='stilts_execute.sh', content=None, shell='zsh', return_output=False)[source]

Creates and executes a shell script in a specified directory.

This function first generates a shell script by calling the spawn_shell_script function, then runs it using the specified shell (default is zsh). Optionally, the output and errors of the script execution can be printed.

Parameters:
  • destination_path (str) – Directory where the script will be created and executed.

  • name (str, optional) – Name of the shell script file. (Default: “stilts_execute.sh”)

  • content (str, optional) – Custom content for the shell script. If None, a default is used. See spawn_shell_script

  • content. (for details on the default script)

  • shell (str, optional) – Shell to use for execution (e.g., “zsh”, “bash”). Defaults to “zsh”.

  • return_output (bool, optional) – Whether to print stdout, stderr, and return code. Defaults to False.

Returns:

None

CatMatcher.shell_helper.spawn_shell_script(destination_path, name, content)[source]

Creates and saves a shell script file to the specified destination with executable permissions.

If no content is provided, a default zsh (korn-shell, standard for macOS systems) script is written that: - Sources ~/.zshrc - Prints the current working directory (cwd) (currently used only as fail-save for verification purposes) - Loops over .txt files at the cwd and executes them if executable

Parameters:
  • destination_path (str) – Path where the script will be saved.

  • name (str) – Name of the script file to create.

  • content (str) – The content of the shell script. If None, the default script is used.

Returns:

None