Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ugly exit from fzf integration #110

Open
AvianAnalyst opened this issue Dec 6, 2023 · 3 comments
Open

Ugly exit from fzf integration #110

AvianAnalyst opened this issue Dec 6, 2023 · 3 comments

Comments

@AvianAnalyst
Copy link

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
Copy link

SaHHiiLL commented Jan 6, 2024

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
Copy link
Author

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
Copy link

SaHHiiLL commented Feb 4, 2024

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 ]];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants