Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
git-gui--askpass85 linesDownload Raw Back to git-core
1#!/bin/sh2# Tcl ignores the next line -*- tcl -*- \3exec 'wish' "$0" -- "$@"4 5# This is a trivial implementation of an SSH_ASKPASS handler.6# Git-gui uses this script if none are already configured.7 8package require Tk9 10set answer {}11set yesno  012set rc     25513 14if {$argc < 1} {15	set prompt "Enter your OpenSSH passphrase:"16} else {17	set prompt [join $argv " "]18	if {[regexp -nocase {\(yes\/no\)\?\s*$} $prompt]} {19		set yesno 120	}21}22 23message .m -text $prompt -justify center -aspect 400024pack .m -side top -fill x -padx 20 -pady 20 -expand 125 26entry .e -textvariable answer -width 5027pack .e -side top -fill x -padx 10 -pady 1028 29proc on_show_input_changed {args} {30	global show_input31	if {$show_input} {32		.e configure -show ""33	} else {34		.e configure -show "*"35	}36}37trace add variable show_input write "on_show_input_changed"38 39set show_input 040 41if {!$yesno} {42	checkbutton .cb_show -text "Show input" -variable show_input43	pack .cb_show -side top -anchor nw44}45 46frame .b47button .b.ok     -text OK     -command finish48button .b.cancel -text Cancel -command cancel49 50pack .b.ok -side left -expand 151pack .b.cancel -side right -expand 152pack .b -side bottom -fill x -padx 10 -pady 1053 54bind . <Visibility> {focus -force .e}55bind . <Key-Return> [list .b.ok invoke]56bind . <Key-Escape> [list .b.cancel invoke]57bind . <Destroy>    {set rc $rc}58 59proc cancel {} {60	set ::rc 25561}62 63proc finish {} {64	if {$::yesno} {65		if {$::answer ne "yes" && $::answer ne "no"} {66			tk_messageBox -icon error -title "Error" -type ok \67				-message "Only 'yes' or 'no' input allowed."68			return69		}70	}71 72	# On Windows, force the encoding to UTF-8: it is what `git.exe` expects73	if {$::tcl_platform(platform) eq {windows}} {74		set ::answer [encoding convertto utf-8 $::answer]75	}76 77	puts $::answer78	set ::rc 079}80 81wm title . "OpenSSH"82tk::PlaceWindow .83vwait rc84exit $rc85 
codekingpro/portable-devtools · Team Ai