Posted to tcl by guardian at Wed Jan 30 10:03:30 GMT 2019view raw
- prompt() {
- if [[ -t 1 ]]; then
- IFS=; while read -rp "$1 (y/n)" -n1 _yn; do
- printf '\n'
- case $_yn in
- [Yy])
- return 0;;
- [Nn])
- return 1;;
- esac;
- done < /dev/tty
- else
- case $(cat<<EOF |
- wm withdraw .
- puts [tk_messageBox -title "Git" -message "$1" -type yesno -icon question]
- exit
- EOF
- /usr/bin/env wish) in
- yes)
- return 0;;
- no)
- return 1;;
- esac;
- fi
- }