From 4718281aadf725f6dbd0b308123dca98af2f5edf Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Fri, 4 Apr 2025 13:15:20 +0200 Subject: fix(modules/lf/commands/thrash_*): Support paths with spaces in them Oherwise `./some thrash path` would not work. --- modules/by-name/lf/lf/commands/scripts/trash_clear.sh | 4 ++-- modules/by-name/lf/lf/commands/scripts/trash_restore.sh | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/by-name/lf/lf/commands/scripts/trash_clear.sh b/modules/by-name/lf/lf/commands/scripts/trash_clear.sh index faa3c553..a41dce27 100755 --- a/modules/by-name/lf/lf/commands/scripts/trash_clear.sh +++ b/modules/by-name/lf/lf/commands/scripts/trash_clear.sh @@ -1,8 +1,8 @@ # shellcheck shell=sh -while read -r file; do +while IFS="$(printf '\n')" read -r file; do set -- "$@" "$(pwd)/$file" -done <"$(conceal list | fzf --multi --ansi | awk '{for(i=3; i<=NF; i++) {print $i}}' | tmp)" +done <"$(conceal list | fzf --multi --ansi | awk '{$1="";$2=""; print $0}' | sed 's/^\s*//' | tmp)" [ "$#" -ne 0 ] && trash empty --match=exact "$@" diff --git a/modules/by-name/lf/lf/commands/scripts/trash_restore.sh b/modules/by-name/lf/lf/commands/scripts/trash_restore.sh index f685345f..5a7624db 100755 --- a/modules/by-name/lf/lf/commands/scripts/trash_restore.sh +++ b/modules/by-name/lf/lf/commands/scripts/trash_restore.sh @@ -9,9 +9,10 @@ fs="$fs" # shellcheck disable=SC2269 id="$id" -while read -r file; do +while IFS="$(printf '\n')" read -r file; do set -- "$@" "$(pwd)/$file" -done <"$(conceal list | fzf --multi --ansi | awk '{for(i=3; i<=NF; i++) {print $i}}' | tmp)" +done <"$(conceal list | fzf --multi --ansi | awk '{$1="";$2=""; print $0}' | sed 's/^\s*//' | tmp)" + [ "$#" -ne 0 ] && trash restore --match=exact "$@" # vim: ft=sh -- cgit 1.4.1