Skip to content

Commit 47b6aa8

Browse files
dschoj6t
authored andcommitted
git-gui--askyesno: allow overriding the window title
"Question?" is maybe not the most informative thing to ask. In the absence of better information, it is the best we can do, of course. However, Git for Windows' auto updater just learned the trick to use git-gui--askyesno to ask the user whether to update now or not. And in this scripted scenario, we can easily pass a command-line option to change the window title. So let's support that with the new `--title <title>` option. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
1 parent aeaabeb commit 47b6aa8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

git-gui--askyesno

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,26 @@ exec wish "$0" -- "$@"
55
# This is an implementation of a simple yes no dialog
66
# which is injected into the git commandline by git gui
77
# in case a yesno question needs to be answered.
8+
#
9+
# The window title, which defaults to "Question?", can be
10+
# overridden via the optional `--title` command-line
11+
# option.
812

913
set NS {}
1014
set use_ttk [package vsatisfies [package provide Tk] 8.5]
1115
if {$use_ttk} {
1216
set NS ttk
1317
}
1418

19+
set title "Question?"
1520
if {$argc < 1} {
1621
puts stderr "Usage: $argv0 <question>"
1722
exit 1
1823
} else {
24+
if {$argc > 2 && [lindex $argv 0] == "--title"} {
25+
set title [lindex $argv 1]
26+
set argv [lreplace $argv 0 1]
27+
}
1928
set prompt [join $argv " "]
2029
}
2130

@@ -38,5 +47,5 @@ pack .b -side bottom -fill x -ipadx 20 -ipady 15
3847
bind . <Key-Return> {exit 0}
3948
bind . <Key-Escape> {exit 1}
4049

41-
wm title . "Question?"
50+
wm title . $title
4251
tk::PlaceWindow .

0 commit comments

Comments
 (0)