From f30ec262ec7f47e1627b7266b22ab6c98d765357 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Mon, 22 Jan 2024 14:59:19 -0500 Subject: [PATCH] Make histclean show changes in file size, remove itself from history --- programs/zsh-histclean/histclean | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/programs/zsh-histclean/histclean b/programs/zsh-histclean/histclean index 2de032b..677b89a 100755 --- a/programs/zsh-histclean/histclean +++ b/programs/zsh-histclean/histclean @@ -1,11 +1,14 @@ #!/usr/bin/env zsh +echo 'Starting history size:' +ls -lh ~/.cache/zsh-histfile | cut -d " " -f5 + hist=() while IFS= read -r line; do if [[ $line == "./"* || $line == "/"* ]]; then hist+=($line) - else + elif [[ $line != "histclean" ]]; then which $(echo $line | cut -d " " -f1) > /dev/null [[ $? == 0 ]] && hist+=($line) fi @@ -15,3 +18,6 @@ echo -n "" > "$XDG_CACHE_HOME"/zsh-histfile for item in "${hist[@]}"; do echo "$item" >> "$XDG_CACHE_HOME"/zsh-histfile done + +echo 'Ending history size:' +ls -lh ~/.cache/zsh-histfile | cut -d " " -f5