git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Johannes Sixt <j6t@kdbg.org>,
	Johannes Schindelin <johannes.schindelin@gmx.de>,
	Pratyush Yadav <me@yadavpratyush.com>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH v2 3/4] git-gui--askyesno: allow overriding the window title
Date: Thu, 28 Aug 2025 08:58:49 +0000	[thread overview]
Message-ID: <2e7e2c1524a73b3c1aaf28baf5689be4093f62ed.1756371530.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.358.v2.git.1756371530.gitgitgadget@gmail.com>

From: Johannes Schindelin <johannes.schindelin@gmx.de>

"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>
---
 git-gui--askyesno | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/git-gui--askyesno b/git-gui--askyesno
index f7312c70c2ca..d0c801c42c7c 100755
--- a/git-gui--askyesno
+++ b/git-gui--askyesno
@@ -5,6 +5,10 @@ exec wish "$0" -- "$@"
 # This is an implementation of a simple yes no dialog
 # which is injected into the git commandline by git gui
 # in case a yesno question needs to be answered.
+#
+# The window title, which defaults to "Question?", can be
+# overridden via the optional `--title` command-line
+# option.
 
 set NS {}
 set use_ttk [package vsatisfies [package provide Tk] 8.5]
@@ -12,10 +16,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 " "]
 }
 
@@ -38,5 +47,5 @@ pack .b -side bottom -fill x -ipadx 20 -ipady 15
 bind . <Key-Return> {exit 0}
 bind . <Key-Escape> {exit 1}
 
-wm title . "Question?"
+wm title . $title
 tk::PlaceWindow .
-- 
gitgitgadget


  parent reply	other threads:[~2025-08-28  8:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-26 15:29 [PATCH 0/4] git-gui: GIT_ASK_YESNO/GIT_ASKPASS patches from Git for Windows Johannes Schindelin via GitGitGadget
2019-09-26 15:29 ` [PATCH 1/4] git-gui: provide question helper for retry fallback on Windows Heiko Voigt via GitGitGadget
2019-09-29 17:11   ` Pratyush Yadav
2019-09-26 15:29 ` [PATCH 2/4] git gui: set GIT_ASKPASS=git-gui--askpass if not set yet Johannes Schindelin via GitGitGadget
2019-09-29 17:15   ` Pratyush Yadav
2019-09-26 15:29 ` [PATCH 3/4] git-gui--askyesno: allow overriding the window title Johannes Schindelin via GitGitGadget
2019-09-29 17:31   ` Pratyush Yadav
2019-09-26 15:30 ` [PATCH 4/4] git-gui--askyesno (mingw): use Git for Windows' icon, if available Johannes Schindelin via GitGitGadget
2019-09-29 18:01   ` Pratyush Yadav
2025-08-28  8:58 ` [PATCH v2 0/4] git-gui: GIT_ASK_YESNO/GIT_ASKPASS patches from Git for Windows Johannes Schindelin via GitGitGadget
2025-08-28  8:58   ` [PATCH v2 1/4] git-gui: provide question helper for retry fallback on Windows Heiko Voigt via GitGitGadget
2025-08-28  8:58   ` [PATCH v2 2/4] git gui: set GIT_ASKPASS=git-gui--askpass if not set yet Johannes Schindelin via GitGitGadget
2025-08-28 17:44     ` Johannes Sixt
2025-08-28  8:58   ` Johannes Schindelin via GitGitGadget [this message]
2025-08-28  8:58   ` [PATCH v2 4/4] git-gui--askyesno (mingw): use Git for Windows' icon, if available Johannes Schindelin via GitGitGadget
2025-08-28 13:33     ` [PATCH] git-gui: use tk_messageBox for ask yes/no Mark Levedahl
2025-08-28 13:49       ` Johannes Schindelin
2025-08-28 21:18       ` Johannes Sixt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2e7e2c1524a73b3c1aaf28baf5689be4093f62ed.1756371530.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    --cc=johannes.schindelin@gmx.de \
    --cc=me@yadavpratyush.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).