Skip to content

Commit

Permalink
git-gui--askyesno: allow overriding the window title
Browse files Browse the repository at this point in the history
"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 <[email protected]>
  • Loading branch information
dscho committed Dec 30, 2024
1 parent d2a95c9 commit e85ee97
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion git-gui/git-gui--askyesno
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,15 @@ if {$use_ttk} {
set NS ttk
}

set title "Question?"
if {$argc < 1} {
puts stderr "Usage: $argv0 <question>"
exit 1
} else {
if {$argc > 2 && [lindex $argv 0] == "--title"} {
set title [lindex $argv 1]
set argv [lreplace $argv 0 1]
}
set prompt [join $argv " "]
}

Expand Down Expand Up @@ -47,5 +52,5 @@ proc yes {} {
exit 0
}

wm title . "Question?"
wm title . $title
tk::PlaceWindow .

0 comments on commit e85ee97

Please sign in to comment.