[SCNR] Re: [FYI PATCH] git wrapper: DWIM mistyped commands
- From
Pierre Habouzit <madcoder@debian.org>
- Date
- Jul 22, 2008, 20:16 UTC
- Message-ID
- <20080722201648.GB11831@artemis.madism.org>
- In-Reply-To
- <alpine.DEB.1.00.0807222100150.8986@racer>
On Tue, Jul 22, 2008 at 08:01:29PM +0000, Johannes Schindelin wrote:
Show 27 quoted lines
> > 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
tsaand 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