From d328a324a67ecc3d4e252f11a0ee3e1900462d03 Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Sat, 28 Sep 2024 11:23:10 -0400 Subject: [PATCH] sync-res: added script also have trash now --- programs | 3 ++- src/dot_local/bin/executable_sorter.sh | 4 ++-- src/dot_local/bin/executable_sync-res.sh | 28 ++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 src/dot_local/bin/executable_sync-res.sh diff --git a/programs b/programs index ea5eef3..0f5392f 100644 --- a/programs +++ b/programs @@ -62,6 +62,7 @@ libappimage nftables sdcv ufw +trash-cli rofi rink progress @@ -72,11 +73,11 @@ which dnsutils man-pages zoxide +tinyxxd # IME input fcitx5 fcitx5-chinese-addons fcitx5-configtool -tinyxxd # in the aur tmsu diff --git a/src/dot_local/bin/executable_sorter.sh b/src/dot_local/bin/executable_sorter.sh index 40cc60c..916f12c 100644 --- a/src/dot_local/bin/executable_sorter.sh +++ b/src/dot_local/bin/executable_sorter.sh @@ -1,5 +1,6 @@ #!/bin/sh # Categorize files in the quarantine directory +# depends: fzf, mpv # read -n 1 isn't POSIX-compliant so we implement something # https://unix.stackexchange.com/questions/464930/can-i-read-a-single-character-from-stdin-in-posix-shell @@ -56,7 +57,6 @@ PREVNAME="" find ~/quar \ -maxdepth 1 \ -type f \ - -not -path '*/trash/*' \ \( \ -name '*.mov' -o \ -name '*.MOV' -o \ @@ -97,7 +97,7 @@ while read -r FILE; do break fi;; s ) break;; - d ) mv "$FILE" ~/quar/trash/; break;; + d ) trash "$FILE"; break;; * ) printf "\nInvalid input! Press enter to continue\n"; read &1 + exit 1 +} + +PROGNAME=$(basename "$0") +if [ -z "$1" ]; then + die usage: $PROGNAME file.sync-conflict-XXXXXXXX-XXXXXX-XXXXXXX +fi + +ORIG=$(echo "$1" | sed 's/\.sync-conflict.*$//') + +if [ "$ORIG" = "$1" ]; then + die Could not find original file. Is this a sync-conflict file? +else + printf "Using original file '%s'.\n" "$ORIG" +fi + +diff --color=always "$1" "$ORIG" > /dev/tty +trash -i "$1"