Re: [Feature Request] Did you mean `git ...`? should ask user for feedback, not return to the prompt
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Dec 19, 2013, 23:17 UTC
- Message-ID
- <20131219231759.GF20443@google.com>
- In-Reply-To
- <CAMi+fEnVekrWYrG6sGiRPmOXxaJ1-Y9xd83W7Wvw3GwWz8DuBQ@mail.gmail.com>
(cc-ing area experts) Hi,
Eric Andrew Lewis wrote:
Show 5 quoted lines
> Git is smart enough to realize when you make a spelling error and > enter a non-existent git command. Since you probably do mean what it > suggests, it follows that the user would want to immediately say “yes, > I did want to do that,” rather than return to the command line to > enter the command again.
Yeah, it's a real tease. :/
Show 5 quoted lines
> e.g. > > $ git psh > git: 'psh' is not a git command. See 'git —help'. > Did you mean 'push'[y/n]?
This is a natural extension to the existing "ticking time bomb" feature that can be enabled with
echo '[help] autocorrect = 50' >>~/.gitconfig
Some value like "autocorrect = ask" could mean to prompt, and the default behavior could be not to prompt (to avoid breaking muscle memory for people used to the usual "just succeed or fail, don't interact" behavior) but to mention that configuration in the output to make it easy to discover.
With that tiny tweak, it sounds good to me. I stole this idea from http://thread.gmane.org/gmane.comp.version-control.git/197151/focus=197249 and the surrounding thread, which also has rough hints toward an implementation.
Thanks and hope that helps, Jonathan