Re: [PATCH] On error, do not list all commands, but point to --help option.

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

 



Jan Hudec wrote:
On Sun, Oct 21, 2007 at 14:42:25 +0200, Andreas Ericsson wrote:
Wincent Colaiuta wrote:
El 21/10/2007, a las 4:06, Shawn O. Pearce escribió:
Johannes Schindelin <Johannes.Schindelin@xxxxxx> wrote:
On Sat, 20 Oct 2007, Jari Aalto wrote:

- commented out call to list_common_cmds_help()
Well, I'm almost sure of the opposite. One of the big results of the Git
Survey was that git is still not user-friendly enough.  Your patch would
only make this issue worse.
Actually I think Jari's patch helps for the reason originally
stated in the message (less output when you make a small typo).
Though I agree that the commented out code should just be removed.

I actually had to do `git config alias.upsh push` just to keep
myself from screaming every time I made a small typo and Git gave
me a screenful of "helpful reminders".
If you want to go really user friendly, how about a check against the list of known commands using a shortest-edit distance algorithm?
http://en.wikipedia.org/wiki/Levenshtein_distance

Implementing the algorithm doesn't seem terribly difficult.

That's not the correct algorithm (you need to consider transpozitions, so you
need at least http://en.wikipedia.org/wiki/Damerau-Levenshtein_distance, but
I would not think that's the easier, or faster, way to do it. Though this
would have to be benchmarked -- calculating the edit distance is quadratic,
while generating the list of possibilities (and seeing whether they exist) is
linear, but with large constant. So the question is, whether we have few
enough commands that the quadratic calculation might be faster.


It's intended to be used for strings of length 3-14, run through once when the
user has given bogus input. We're not gonna index databases here. Simplicity
in the implementation almost certainly outweighs the performance penalty of
doing it the stupid way.

--
Andreas Ericsson                   andreas.ericsson@xxxxxx
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
-
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]

  Powered by Linux