Posted to tcl by guardian at Wed Jan 30 10:54:24 GMT 2019view pretty

prompt() {
  if false; 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
    osascript -e 'repeat until application "Wish" is running'\
              -e 'delay 0.1'\
              -e 'end repeat'\
              -e 'tell application "Wish" to activate'&
    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
}