diff --git a/.zshrc b/.zshrc index 73733c2..e4293f8 100644 --- a/.zshrc +++ b/.zshrc @@ -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 ###