[SCNR] Re: [FYI PATCH] git wrapper: DWIM mistyped commands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx
OOO                                                http://www.madism.org

Attachment: pgpwKhoNndyj2.pgp
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux