Skip to main content

Module shell_integration_installer

Module shell_integration_installer 

Source
Expand description

Shell integration installation logic.

This module handles installing and uninstalling shell integration scripts for bash, zsh, and fish shells. It:

  • Embeds shell scripts via include_str!
  • Detects the current shell from $SHELL
  • Writes scripts to ~/.config/par-term/shell_integration.{bash,zsh,fish}
  • Adds marker-wrapped source lines to RC files
  • Supports clean uninstall that safely removes the marker blocks

RC files are rewritten through [write_rc_file], which stages the new contents in a sibling temp file and renames it into place while keeping the file’s existing mode. Everything else in this module writes par-term’s own reconstructable content and uses a plain fs::write.

§Error Handling Convention

Private helpers use Result<(), String> for simple string errors that are surfaced to the caller for display. New code added to this module should follow the same pattern.

Structs§

InstallResult
Result of installation
UninstallResult
Result of uninstallation

Functions§

detected_shell
Detect shell type from $SHELL environment variable
install
Install shell integration for detected or specified shell
is_installed
Check if shell integration is installed for the detected shell
uninstall
Uninstall shell integration for all supported shells