‘unisntall’ - https://github.com/npm/npm/issues/6095
‘verison’ - https://github.com/npm/npm/pull/6832
When someone makes a typo there are 2 possible outcomes. Outcome 1: they are informed of their error and they can correct it or make an alias in their shell. Outcome 2: npm grows a new help option for every reported typo and eventually begins calculating the Levenshtein distance between the nearest valid option (an actual suggestion in the issue). Eventually typos make it into source code and scripts. Good luck grepping your codebase for usages of npm install.
Introducing this “affordance” to the user results in a cascade of increased complexity. Furthermore it’s not “just” complexity in the toolset, but an increased cognitive load on the programmer. What’s next? I can only imagine how frightening using node would be if npm install package installed some other random package off the internet.
npm install package
Please keep “did you mean” functionality limited to search UIs.
I guess if the user has such a problem with accidentally typing “npm isntall”, “npm unisntall” or “npm verison”, they should just create aliases in their own shell config instead of bloating the software.
Good luck grepping your codebase for usages of npm install.
This is easily fixed by making grep default to matching on small Levenshtein distances too! (Yes, this is sarcasm.)
Well, it probably wouldn’t be so hard to extend regexes to compute a Levenshtein DFA during the compilation stage for fuzzy matching.
[Is it bad that I’m wondering how hard it would be to implement, as a fun regex hack?]
There’s a comment from Isaac himself in one of these threads:
Removing isntall – or worse, replacing it with a Erm, so, I believe you meant “install”, perhaps if you invest in a typing tutor, preferably using a proper keyboard such as dvorak, you’d avoid such foolish errors type of message – is contrary to the spirit and voice of the npm client. It is a loving being who endeavors to be as helpful and friendly as possible. If it knows what you mean, it’ll just do what you wanted.
This comment pretty perfectly describes the cheerfully clumsy attitude to software that I think npm wholly embodies. On the one hand, it purports to justify inconsistently elevating some misspellings of an actual command (why not other misspellings?). On the other hand it makes sure to take an emotionally loaded swipe at people that actually value precision in their software.
Command line interfaces should validate their input and report failure when your input does not make sense. At present, it seems that NPM still simply ignores any random flags you pass to a command; whether a misspelling of --save, or something random like --blerg. Depending on the misspelling you may accidentally drop an argument that you really meant to specify – this is not friendly, it is just unsafe.
I’m reminded of the anecdote in http://www.catb.org/jargon/html/D/DWIM.html. Automatic do-what-I-mean is dangerous! If you must implement it at all, git’s “did you mean” message is absolutely the furthest it should go (and since I suspect 99% of git commandline typos are obvious a la git lgo, the value of that feature is disproportionately below the amount of code written to implement it).
Some one pointed out that it also spells out isn't all and just like that I’m thinking isntall could be a valid command that is not install. Not sure what isntall would do per se, but it could still be abstracted into something valid. I don’t like the idea of the codebase assuming I made a typo and going ahead with the command it thinks I want. I may have quick fingers but I’m not stupid.
It drops npm into the existential-reflection shell, presumably.
There’s a clickbait blog article waiting to be written titled npm isntall that
npm isntall that
And then be all about the this keyword and never touch the isntall part.
Wait, I thought this was for checking the height of a dependency tree.
The real solution is having nice shell completions so people can tab their way to happiness.
That escalated quickly.
I am just glad it doesn’t search amazon for “isntall pkg” when you typo it.
Isn’t all a package? :D
Incoming: command line utils should ship with spell-checkers, because they don’t exist to punish people for their spelling mistakes. This is annoying me more than it should, since I use no node.js at all :)