feat(zsh): whiptail helper

This commit is contained in:
Michel 2024-01-17 16:32:04 +01:00
parent 7df92af4f1
commit 0756bd5272
1 changed files with 18 additions and 0 deletions

18
.zshrc
View File

@ -277,6 +277,24 @@ zle -N nnn-file-widget
bindkey -M vicmd '\en' nnn-file-widget
bindkey -M viins '\en' nnn-file-widget
# Whiptail helper
#
menu_choose() {
local res title="$1" text="$2"
shift 2
local -a tags
for tag;
{ tags+=($tag $tag) }
# see https://stackoverflow.com/questions/1970180/whiptail-how-to-redirect-output-to-environment-variable
tag=$(whiptail --title $title --menu $text 25 40 15 $tags --notags 3>&1 1>&2 2>&3 3>&-)
res=$?
echo $tag
return $res
}
###
### Aliases -- Global & automatic expansion
###