diff: make the context menu more consistent when unstaging
[git-cola.git] / cola / bin / ssh-askpass-darwin
blob9de1a3a04c20081c021b3110d2a0d8b1c703510b
1 #! /bin/sh
2 TITLE=${MACOS_ASKPASS_TITLE:-"SSH"}
3 DIALOG="display dialog \"$@\" default answer \"\" with title \"$TITLE\""
4 DIALOG="$DIALOG with icon caution"
6 yesno=
7 if echo "$1" | grep "'yes'" 2>&1 >/dev/null ||
8 echo "$1" | grep "yes/no" 2>&1 >/dev/null
9 then
10 yesno=true
14 if test -z "$yesno"
15 then
16 DIALOG="$DIALOG with hidden answer"
19 result=$(osascript \
20 -e 'tell application "Finder"' \
21 -e "activate" \
22 -e "$DIALOG" \
23 -e 'end tell' 2>/dev/null)
25 if test -z "$result"
26 then
27 exit 1
30 # The beginning of the output can be either "text returned:"
31 # or "button returned:", and is Mac OS X version-dependent.
32 # Account for both output styles.
33 printf '%s\n' "$result" |
34 sed -e 's/^text returned://' -e 's/, button returned:.*$//' \
35 -e 's/^button returned:OK, text returned://'
36 exit 0