| # Tcl ignores the next line -*- tcl -*- \ |
| # This is a trivial implementation of an SSH_ASKPASS handler. |
| # Git-gui uses this script if none are already configured. |
| set prompt "Enter your OpenSSH passphrase:" |
| set prompt [join $argv " "] |
| if {[regexp -nocase {\(yes\/no\)\?\s*$} $prompt]} { |
| message .m -text $prompt -justify center -aspect 4000 |
| pack .m -side top -fill x -padx 20 -pady 20 -expand 1 |
| entry .e -textvariable answer -width 50 |
| pack .e -side top -fill x -padx 10 -pady 10 |
| button .b.ok -text OK -command finish |
| button .b.cancel -text Cancel -command {destroy .} |
| pack .b.ok -side left -expand 1 |
| pack .b.cancel -side right -expand 1 |
| pack .b -side bottom -fill x -padx 10 -pady 10 |
| bind . <Visibility> {focus -force .e} |
| bind . <Key-Return> finish |
| bind . <Key-Escape> {destroy .} |
| bind . <Destroy> {exit $rc} |
| if {$::answer ne "yes" && $::answer ne "no"} { |
| tk_messageBox -icon error -title "Error" -type ok \ |
| -message "Only 'yes' or 'no' input allowed." |