From: Pierre Habouzit <madcoder@debian.org>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org
Subject: [SCNR] Re: [FYI PATCH] git wrapper: DWIM mistyped commands
Date: Tue, 22 Jul 2008 22:16:48 +0200 [thread overview]
Message-ID: <20080722201648.GB11831@artemis.madism.org> (raw)
In-Reply-To: <alpine.DEB.1.00.0807222100150.8986@racer>
[-- Attachment #1: Type: text/plain, Size: 1627 bytes --]
On Tue, Jul 22, 2008 at 08:01:29PM +0000, Johannes Schindelin wrote:
>
> This patch introduces a modified Damerau-Levenshtein algorithm into
> Git's code base, and uses it with the following penalties to show some
> similar commands when an unknown command was encountered:
>
> swap = 0, insertion = 1, substitution = 2, deletion = 4
>
> A typical output would now look like this:
>
> $ git sm
> git: 'sm' is not a git-command. See 'git --help'.
>
> Did you mean one of these?
> am
> rm
>
> The cut-off is at similarity rating 6, which was empirically determined
> to give sensible results.
>
> As a convenience, if there is only one candidate, Git continues under
> the assumption that the user mistyped it. Example:
>
> $ git reabse
> WARNING: You called a Git program named 'reabse', which does
> not exist.
> Continuing under the assumption that you meant 'rebase'
> [...]
<SCNR>
Or use a decent shell:
When typing e.g.: git tsa<tab>, it yields:
$ git status
---- corrections (errors 1)
status -- show working-tree's status
tag -- create tag object signed with GPG
tar-tree -- create tar archive of the files in the named tree
---- original
tsa
and it even works for non git commands ;)
</SCNR>
Despite that, I really like your idea. **hint hint** One could even hook that
for long options into parse-options.
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
next prev parent reply other threads:[~2008-07-22 20:17 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-22 20:01 [FYI PATCH] git wrapper: DWIM mistyped commands Johannes Schindelin
2008-07-22 20:16 ` Pierre Habouzit [this message]
2008-07-22 20:19 ` [SCNR] " Johannes Schindelin
2008-07-22 20:34 ` Pierre Habouzit
2008-07-22 20:37 ` Alex Riesen
2008-07-22 21:03 ` [PATCH] Add help.autocorrect to enable/disable autocorrecting Alex Riesen
2008-07-22 21:08 ` Johannes Schindelin
2008-07-22 21:26 ` Alex Riesen
2008-07-22 21:44 ` Johannes Schindelin
2008-07-22 22:25 ` Alex Riesen
2008-07-23 16:44 ` Johannes Schindelin
2008-07-23 18:44 ` Alex Riesen
2008-07-23 19:00 ` Johannes Schindelin
2008-07-23 19:04 ` Johannes Schindelin
2008-07-22 23:08 ` Junio C Hamano
2008-07-23 16:41 ` [PATCH] Wait help.autocorrect deciseconds before running corrected command Alex Riesen
2008-07-23 16:57 ` Johannes Schindelin
2008-07-23 18:45 ` Alex Riesen
2008-07-22 23:05 ` [FYI PATCH] git wrapper: DWIM mistyped commands Junio C Hamano
2008-07-22 23:10 ` Sverre Rabbelier
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080722201648.GB11831@artemis.madism.org \
--to=madcoder@debian.org \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).