1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-10-26 13:40:10 +03:00

rc tools menu: add -on-abort switch

Along -select-cmds this is useful to implement preview functionality.
This commit is contained in:
Johannes Altmanninger 2023-11-20 20:38:34 +01:00
parent 1f11529837
commit d1037072b0

View File

@ -11,11 +11,13 @@ define-command menu -params 1.. -docstring %{
auto_single=false
select_cmds=false
stride=2
on_abort=
while true
do
case "$1" in
(-auto-single) auto_single=true ;;
(-select-cmds) select_cmds=true; stride=3 ;;
(-on-abort) on_abort="$2"; shift ;;
(-markup) ;; # no longer supported
(*) break ;;
esac
@ -73,6 +75,9 @@ define-command menu -params 1.. -docstring %{
§" "$select_cases"
fi
if [ -n "$on_abort" ]; then
printf " -on-abort '%s'" "$(printf %s "$on_abort" | sed "s/'/''/g")"
fi
printf ' -menu -shell-script-candidates %%§
printf %%s %s
§\n' "$(shellquote "$completion")"