Ugly exit from fzf integration
Opened this issue · 3 comments
AvianAnalyst commented
With the provided fzf integration commands, if you run one, but decide to abort the operation, you have to quit twice. Is there a better solution for this?
SaHHiiLL commented
Had the same issues, solved it with this
list=$(trash list | fzf --multi)
if [[ -n $list ]]; then
echo $list | awk '{$1=$1;print}' | rev | cut -d ' ' -f1 | rev | xargs trash restore --match=exact --force
else
echo "Aborted"
fi
AvianAnalyst commented
Thank you! sorry for the slow reply. I'm trying to try this out but im unclear. is this verbatim an alias? or a function? specifically unsure how the if block is connected into the previous line. or is the whole thing just the function body?
SaHHiiLL commented
it's upto you how you want to use it. You can inline everything and alias it or wrap it in a script/function.
the if block just checks whether $list
is empty or not
PS: i noted there a missing whitespace in the example above.
fix: [[ -n $list ]];