2 # Tcl ignores the next line -*- tcl -*- \
5 # This is a trivial implementation of an SSH_ASKPASS handler.
6 # Git-gui uses this script if none are already configured.
15 set prompt "Enter your OpenSSH passphrase:"
17 set prompt [join $argv " "]
18 if {[regexp -nocase {\(yes\/no\)\?\s*$} $prompt]} {
23 message .m -text $prompt -justify center -aspect 4000
24 pack .m -side top -fill x -padx 20 -pady 20 -expand 1
26 entry .e -textvariable answer -width 50
27 pack .e -side top -fill x -padx 10 -pady 10
30 .e configure -show "*"
34 button .b.ok -text OK -command finish
35 button .b.cancel -text Cancel -command cancel
37 pack .b.ok -side left -expand 1
38 pack .b.cancel -side right -expand 1
39 pack .b -side bottom -fill x -padx 10 -pady 10
41 bind . <Visibility> {focus -force .e}
42 bind . <Key-Return> [list .b.ok invoke]
43 bind . <Key-Escape> [list .b.cancel invoke]
44 bind . <Destroy> {set rc $rc}
52 if {$::answer ne "yes" && $::answer ne "no"} {
53 tk_messageBox -icon error -title "Error" -type ok \
54 -message "Only 'yes' or 'no' input allowed."
59 # On Windows, force the encoding to UTF-8: it is what `git.exe` expects
60 if {$::tcl_platform(platform) eq {windows}} {
61 set ::answer [encoding convertto utf-8 $::answer]