Skip to main content

export_bash

Function export_bash 

Source
pub fn export_bash(session: &Session, params: Option<&[Parameter]>) -> String
Expand description

Export a session as a bash script.

Generates a self-contained bash script with:

  • Shebang and strict mode (set -euo pipefail)
  • Metadata header (session name, date, command count)
  • Variable declarations when parameters are provided
  • Commands with cd when working directory changes
  • Annotations for failed commands (non-zero exit codes)
  • Footer comment

When params is Some, commands have auto-detected values replaced with $VAR references and variable declarations are added after set -euo pipefail.

Empty sessions produce a valid script with a “No commands recorded” note.