I find the prompt
command quite awkward to work with. This command will prompt a ‘y/n’ (though it still needs to confirm). Posting it just cause. Improvements?
Usage: prompt-yes-no 'question to user: ' your-command-on-action
– none of the prompt
switches will work w/ this implementation (-init y
is hard coded).
define-command -override -params 2 prompt-yes-no %{
evaluate-commands %sh{
args="${@:1:$#-1}"
cmd="${@: -1}"
# No clue on how ot make prompt here accept the flag arguments properly.
printf 'prompt -init y "%s" %%{evaluate-commands %%sh{
case "$kak_text" in
[yY])
echo %s
;;
?)
;;
esac
}}\n' "$args" "$cmd"
}
}