From: Tay Ray Chuan Date: Mon, 07 May 2012 15:49:25 GMT Subject: Re: [PATCH 4/4] allow recovery from command name typos Message-ID: In-Reply-To: <878vh4con4.fsf@thomas.inf.ethz.ch> On Mon, May 7, 2012 at 5:43 PM, Thomas Rast wrote: > Tay Ray Chuan writes: > >> 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: >>> >>>>   $ 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. > > We already have help.autocorrect.  It defaults to 0, which results in > >  $ g rebest >  git: 'rebest' is not a git command. See 'git --help'. > >  Did you mean one of these? >          rebase >          reset >          revert > > But it can also be a timeout in deciseconds, after which the match is > automatically executed (if there is only one).  You could hijack it by > > * making 'ask' mean your new feature > > * making 'off' etc. be the same as 0 for sanity > > * making the default value be like 0, but with an extra message such as > >    Use 'git config --global help.autocorrect ask' to let me prompt for >    the correct command. > >  though I'm sure you can improve on the wording. Thomas, that's a brilliant idea. Re-roll coming up. -- Cheers, Ray Chuan