Files
dotfiles/fish/functions/copilot_what-the-shell.fish
2023-04-14 07:43:42 +02:00

16 lines
454 B
Fish

function copilot_what-the-shell --description "GitHub Copilot what the shell"
set TMPFILE (mktemp)
trap 'rm -f $TMPFILE' EXIT
if github-copilot-cli what-the-shell $argv --shellout $TMPFILE
if test -e "$TMPFILE"
set FIXED_CMD (cat $TMPFILE)
echo -s "$FIXED_CMD"
eval "$FIXED_CMD"
else
echo "Apologies! Extracting command failed"
end
else
return 1
end
end