Skip to content

smart_exit

Usage
smart_exit [-h] [-n]

Closes the shell session. In Kitty, captures the terminal scrollback to a timestamped log file in $SCROLLBACK_HISTORY_DIR before exiting. Automatically prunes junk and the oldest logs when the count exceeds $SCROLLBACK_HISTORY_MAX_FILES.

-h, --help Show help message
-n, --no-log Exit without saving a scrollback log
0 Shell session exited
1 Argument parsing failed

The exit builtin is wired to smart_exit for interactive sessions. Typing exit or Ctrl+D behaves identically to calling smart_exit directly.

Terminal window
smart_exit
smart_exit --no-log

Dependencies: kitty, ps, _scrollback_prune_junk

Classification: self-limiting(rm,mkdir), destructive