All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Branchaud <marcnarc@xiplink.com>
To: git@vger.kernel.org
Cc: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>,
	Chris Packham <judge.packham@gmail.com>,
	Alex Riesen <raa.lkml@gmail.com>
Subject: [PATCH] Tweak help auto-correct phrasing.
Date: Mon, 19 Dec 2016 12:01:37 -0500	[thread overview]
Message-ID: <20161219170137.5507-1-marcnarc@xiplink.com> (raw)
In-Reply-To: <CAFOYHZDnpzdYq9j4-xGSdKZQX9deLBpZZhz209qV7cCtq537SA@mail.gmail.com>

Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
---

On 2016-12-18 07:48 PM, Chris Packham wrote:
>
> This feature already exists (although it's not interactive). See
> help.autoCorrect in the git-config man page. "git config
> help.autoCorrect -1" should to the trick.

Awesome, I was unaware of this feature.  Thanks!

I found the message it prints a bit awkward, so here's a patch to fix it up.

Instead of:

   WARNING: You called a Git command named 'lgo', which does not exist.
   Continuing under the assumption that you meant 'log'
   in 1.5 seconds automatically...

it's now:

   WARNING: You called a Git command named 'lgo', which does not exist.
   Continuing in 1.5 seconds under the assumption that you meant 'log'.

		M.

 help.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/help.c b/help.c
index 53e2a67e00..55350c0673 100644
--- a/help.c
+++ b/help.c
@@ -381,12 +381,18 @@ const char *help_unknown_cmd(const char *cmd)
 		clean_cmdnames(&main_cmds);
 		fprintf_ln(stderr,
 			   _("WARNING: You called a Git command named '%s', "
-			     "which does not exist.\n"
-			     "Continuing under the assumption that you meant '%s'"),
-			cmd, assumed);
-		if (autocorrect > 0) {
-			fprintf_ln(stderr, _("in %0.1f seconds automatically..."),
-				(float)autocorrect/10.0);
+			     "which does not exist."),
+			   cmd);
+		if (autocorrect < 0)
+			fprintf_ln(stderr,
+				   _("Continuing under the assumption that "
+				     "you meant '%s'."),
+				   assumed);
+		else {
+			fprintf_ln(stderr,
+				   _("Continuing in %0.1f seconds under the "
+				     "assumption that you meant '%s'."),
+				   (float)autocorrect/10.0, assumed);
 			sleep_millisec(autocorrect * 100);
 		}
 		return assumed;
-- 
2.11.0.dirty


  reply	other threads:[~2016-12-19 17:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-18 12:18 Suggestion for the "Did you mean this?" feature Kaartic Sivaraam
2016-12-18 13:16 ` Stephan Beyer
2016-12-18 13:26   ` Kaartic Sivaraam
2016-12-18 15:16 ` Alexei Lozovsky
2016-12-19  0:48 ` Chris Packham
2016-12-19 17:01   ` Marc Branchaud [this message]
2016-12-19 22:04     ` [PATCH] Tweak help auto-correct phrasing Junio C Hamano
2016-12-20 14:02       ` [PATCHv2] " Marc Branchaud
2017-06-20 18:00         ` Kaartic Sivaraam
2017-06-20 18:04         ` Kaartic Sivaraam
2017-06-20 18:21           ` Marc Branchaud
2017-06-21 13:57             ` [PATCHv2 (resend)] " Marc Branchaud
2017-06-21 22:34               ` Junio C Hamano
2016-12-19 19:24   ` Suggestion for the "Did you mean this?" feature Kaartic Sivaraam

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=20161219170137.5507-1-marcnarc@xiplink.com \
    --to=marcnarc@xiplink.com \
    --cc=git@vger.kernel.org \
    --cc=judge.packham@gmail.com \
    --cc=kaarticsivaraam91196@gmail.com \
    --cc=raa.lkml@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.