Give commit message reencoding for output on MinGW a chance
[git/mingw/4msysgit/gitPS1fix.git] / git-gui / git-gui--askyesno
blob2a6e6fd11122f5e981341cb78978e1bb24552bc9
1 #!/bin/sh
2 # Tcl ignores the next line -*- tcl -*- \
3 exec wish "$0" -- "$@"
5 # This is an implementation of a simple yes no dialog
6 # which is injected into the git commandline by git gui
7 # in case a yesno question needs to be answered.
9 set NS {}
10 set use_ttk [package vsatisfies [package provide Tk] 8.5]
11 if {$use_ttk} {
12 set NS ttk
15 if {$argc < 1} {
16 puts stderr "Usage: $argv0 <question>"
17 exit 1
18 } else {
19 set prompt [join $argv " "]
22 ${NS}::frame .t
23 ${NS}::label .t.m -text $prompt -justify center -width 40
24 .t.m configure -wraplength 400
25 pack .t.m -side top -fill x -padx 20 -pady 20 -expand 1
26 pack .t -side top -fill x -ipadx 20 -ipady 20 -expand 1
28 ${NS}::frame .b
29 ${NS}::frame .b.left -width 200
30 ${NS}::button .b.yes -text Yes -command yes
31 ${NS}::button .b.no -text No -command no
34 pack .b.left -side left -expand 1 -fill x
35 pack .b.yes -side left -expand 1
36 pack .b.no -side right -expand 1 -ipadx 5
37 pack .b -side bottom -fill x -ipadx 20 -ipady 15
39 bind . <Key-Return> {exit 0}
40 bind . <Key-Escape> {exit 1}
42 proc no {} {
43 exit 1
46 proc yes {} {
47 exit 0
50 wm title . "Question?"
51 tk::PlaceWindow .