netlify / cli

Netlify Command Line Interface
http://cli.netlify.com
MIT License
1.58k stars 357 forks source link

[DX] Improve command and argument suggestions #3344

Open bramus opened 3 years ago

bramus commented 3 years ago

It's been a while since I did a manual deploy, so I forgot the command (of course) to do so. I tried guessing it from memory, and while I was happy to see that netlify-cli tried to help me out, the suggestions felt really weird:

$ netlify publish
  > warning publish is not a netlify command.
Did you mean unlink [y/n]

I expected netlify-cli to suggest deploy (the correct command) here, instead of the dangerous unlink

$ netlify push
  > warning push is not a netlify command.
Did you mean api [y/n]

I also expected netlify-cli to suggest deploy (the correct command) here, instead of the unrelated api

$ netlify deploy --production
  > Error: unexpected argument: --production
  > See more help with --help

I expected netlify-cli to suggest using --prod (the correct argument) here.

erezrokah commented 3 years ago

To add more context - I believe we're using an oclif plugin for that, see https://github.com/oclif/plugin-not-found. It seems to use Levenshtein distance for guessing the correct command: https://github.com/oclif/plugin-not-found/blob/d7f5ae83c7f2241e9a8b010f6fe13ece26046663/src/index.ts#L15

There might be a better approach to do it, but I can't think of one without doing more research