rc tools menu: add -on-abort switch
Along -select-cmds this is useful to implement preview functionality.
This commit is contained in:
parent
1f11529837
commit
d1037072b0
|
@ -11,11 +11,13 @@ define-command menu -params 1.. -docstring %{
|
||||||
auto_single=false
|
auto_single=false
|
||||||
select_cmds=false
|
select_cmds=false
|
||||||
stride=2
|
stride=2
|
||||||
|
on_abort=
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
(-auto-single) auto_single=true ;;
|
(-auto-single) auto_single=true ;;
|
||||||
(-select-cmds) select_cmds=true; stride=3 ;;
|
(-select-cmds) select_cmds=true; stride=3 ;;
|
||||||
|
(-on-abort) on_abort="$2"; shift ;;
|
||||||
(-markup) ;; # no longer supported
|
(-markup) ;; # no longer supported
|
||||||
(*) break ;;
|
(*) break ;;
|
||||||
esac
|
esac
|
||||||
|
@ -73,6 +75,9 @@ define-command menu -params 1.. -docstring %{
|
||||||
¶
|
¶
|
||||||
§" "$select_cases"
|
§" "$select_cases"
|
||||||
fi
|
fi
|
||||||
|
if [ -n "$on_abort" ]; then
|
||||||
|
printf " -on-abort '%s'" "$(printf %s "$on_abort" | sed "s/'/''/g")"
|
||||||
|
fi
|
||||||
printf ' -menu -shell-script-candidates %%§
|
printf ' -menu -shell-script-candidates %%§
|
||||||
printf %%s %s
|
printf %%s %s
|
||||||
§\n' "$(shellquote "$completion")"
|
§\n' "$(shellquote "$completion")"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user