Add `in the fish shell,` to improve results
github-copilot-cli is obviously tailored for bash/zsh syntax, but it can be nudged a bit to be fishy.
For example, without this change:
❯ !! print numbers from 0 to 10 skipping 5
──────────────────── Command ────────────────────
for i in {0..10}; do
if [ $i -eq 5 ]; then
continue;
fi;
echo $i;
done
This is not a valid fish script.
After prepending in the fish shell, to the query:
❯ !! print numbers from 0 to 10 skipping 5
──────────────────── Command ────────────────────
for i in (seq 0 10); if test $i -ne 5; echo $i; end; end
This works!
In my opinion, it's beneficial to include this prompt prefix globally, since fish syntax is what we always want. It's not perfect (Copilot is very obviously less competent with fish than bash), but it helps with many simple cases like outlined above.
OK, in some cases, this makes Copilot fumble and produce nonsense even when the bash command would actually work in fish as-is.
bash$ ?? print the natural logarithm of 9
──────────────────── Command ────────────────────
python -c "import math; print(math.log(9))"
(works in bash and fish)
vs.
bash$ ?? in the fish shell, print the natural logarithm of 9
──────────────────── Command ────────────────────
math.log(9)
Any variation of "please output fish shell syntax for this command" breaks it. I have not been able to find a formulation that both works for cases like in the top comment, but at the same time works here.
Maybe someone gets kissed with a prompt engineering muse and thinks of something? In any case, I'll be doing more testing.