The following custom command is executed for starting the terminal
/usr/bin/zsh -c 'export SCRIPT_LOG_FILE_NAME=$(date "+%m-%d-%y-%H-%M-%S-%N") && mkdir -p /tmp/script-log/ && script -f -q /tmp/script-log/$SCRIPT_LOG_FILE_NAME' export SCRIPT_LOG_FILE_NAME=$(date "+%m-%d-%y-%H-%M-%S-%N") mkdir -p /tmp/script-log/ script -f -q /tmp/script-log/$SCRIPT_LOG_FILE_NAME
export SCRIPT_LOG_FILE_NAME=$(date "+%m-%d-%y-%H-%M-%S-%N")
mkdir -p /tmp/script-log/
script -f -q /tmp/script-log/$SCRIPT_LOG_FILE_NAME
We can split the log at the last $PS1 prompt and feed the most recent chunk to a utility such as Simon W.'s llm.
Add the following to .zshrc (or …):
alias z='tail -n 100 /tmp/script-log/$SCRIPT_LOG_FILE_NAME | llm -s "Fix it or similar" | pbcopy'
reply
The following custom command is executed for starting the terminal
The date sub-command creates a unique filename for the current session and stores it in SCRIPT_LOG_FILE_NAME. Create a folder in /tmp/script-log/. Script then writes the current terminal session to that file. Now any command run in this terminal knows where the last program wrote its output.We can split the log at the last $PS1 prompt and feed the most recent chunk to a utility such as Simon W.'s llm.
Add the following to .zshrc (or …):
Essentially, run a command; if it fails, run z.