junegunn / fzf

:cherry_blossom: A command-line fuzzy finder
https://junegunn.github.io/fzf/
MIT License
62.32k stars 2.35k forks source link

Add --with-shell for shelling out with different command and flags #3746

Closed junegunn closed 2 months ago

junegunn commented 2 months ago

Close #3732

This hasn't been tested on Windows.

LangLangBart commented 2 months ago

Thanks for dedicating time to implementing it.

Was it a deliberate decision that you made while working on it to not also apply it to the become action?

https://github.com/junegunn/fzf/blob/056cb5e52c7753d303f45dc8cf15777c7d0285ff/src/terminal.go#L3396-L3398

: | fzf --with-shell 'ruby -e' --bind 'enter:become:puts "Hello world"'

The example in the man page works well, but it may cause some issues for people with a defined FZF_DEFAULT_COMMAND. Consider this alternative:

tail /usr/share/dict/words | fzf --with-shell 'ruby -e' --preview 'puts {}.upcase.reverse'
junegunn commented 2 months ago

Was it a deliberate decision that you made while working on it to not also apply it to the become action?

No, it was an oversight.

The example in the man page works well, but it may cause some issues for people with a defined FZF_DEFAULT_COMMAND.

Good point, thanks!

junegunn commented 2 months ago

@rashil2000 Hi, can you take a look at this patch when you have some time? I could use some help on the Windows part, and you're the one who last changed the relevant code in #2647.

rashil2000 commented 2 months ago

@rashil2000 Hi, can you take a look at this patch when you have some time? I could use some help on the Windows part, and you're the one who last changed the relevant code in #2647.

Sure, I'm currently travelling, will have a look in a few days

junegunn commented 2 months ago

So I did some preliminary testing of this on a Windows VM against cmd and powershell, and at least it doesn't seem to break the existing workflow.

junegunn commented 2 months ago

cmd.exe execution is broken, restoring CmdLine parameter.