Re: [PATCH 4/4] allow recovery from command name typos

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

 



Tay Ray Chuan <rctay89@xxxxxxxxx> writes:

> On Sun, May 6, 2012 at 4:21 PM, Jeff King <peff@xxxxxxxx> 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 Rast
trast@{inf,student}.ethz.ch
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]