Closed LangLangBart closed 4 months ago
Thanks, but I'm not sure about this. Correct me if I'm wrong, but we can achieve the same thing by setting $SHELL
to a simple wrapper script that handles the flags, which I think is not bad.
fzf2() (
export SHELL=/tmp/fzfsh
if ! [[ -x $SHELL ]]; then
echo '#!/bin/sh' > "$SHELL"
echo 'shift; echo "$@"' >> "$SHELL"
chmod +x "$SHELL"
fi
command fzf "$@"
)
fzf2 --preview 'run this command: {}'
Having this option may save a few lines of code in some cases, but I'm afraid it will be a niche feature that few will use.
The Windows situation is a bit messy now, and adding support for this might make it more complicated.
simple wrapper script that handles the flags
Your wrapper script is a simple and effective solution. No need for a new feature that few would utilize.
that few would utilize
Technically, this was just my guess, so I can't be 100% sure. But if I recall correctly, there hasn't been a feature request for this in the past years. But if you still like the idea, we can keep this PR open for a while and see what others think.
IMO, if we're really going to add this, it should be easier to use than 1. setting two environment variables, 2. or creating a wrapper script. Something like fzf --with-shell "$SHELL -c"
maybe? Hmm, then we would have another problem of splitting the arguments without the help from a shell. (e.g. fzf --with-shell 'custom-shell --title "hello fzf" -c'
)
I can't reopen the PR as the repo was deleted, but I will file an issue report.
proposal
Ability to alter the flag that is passed to the
$SHELL
command.For example, if the
-c
flag could be altered to-e
, one could usejsc
(JavaScriptCore) to execute JavaScript code without addingjsc -e
to every line.Another example using
bun
and--print
.Pro:
Con:
Issues
Windows
(not tested at all)