From: Tay Ray Chuan Date: Sun, 06 May 2012 16:07:08 GMT Subject: Re: [PATCH 4/4] allow recovery from command name typos Message-ID: In-Reply-To: <20120506082130.GB27878@sigill.intra.peff.net> On Sun, May 6, 2012 at 4:21 PM, Jeff King wrote: > On Sun, May 06, 2012 at 02:55:30PM +0800, Tay Ray Chuan wrote: > >> If suggestions are available (based on Levenshtein distance) and if the >> terminal isatty(), present a prompt to the user to select one of the >> computed suggestions. >> >> In the case where there is a single suggestion, present the prompt >> "[Y/n]", such that "", "y" and "Y" as input leads git to proceed >> executing the suggestion, while everything else (possibly "n") leads git >> to terminate. >> >> In the case where there are multiple suggestions, number the suggestions >> 1 to n, and accept as input one of the numbers, while everything else >> (possibly "n") leads git to terminate. In this case there is no default; >> that is, an empty input leads git to terminate. A sample run: >> >>   $ git sh --pretty=oneline >>   git: 'sh' is not a git command. See 'git --help'. >> >>   Did you mean one of these? >>   1:  show >>   2:  push >>   [1/2/.../n] 1 > > Ugh. Please protect this with a config variable that defaults to > "off".  It is very un-Unix to prompt unexpectedly, and I suspect a lot > of people would be annoyed by this behavior changing by default (I know > I would be). > > -Peff While I agree there should be a config to protect this, I was hoping this would be useful to users on the terminal who make the occasional slip-up, without having to do any prior configuration. -- Cheers, Ray Chuan