Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error message enhancement: wrong module vs. wrong or missing password #16

Open
scaleoutsean opened this issue Aug 18, 2017 · 0 comments

Comments

@scaleoutsean
Copy link
Contributor

scaleoutsean commented Aug 18, 2017

sfcli -m 1.1.1.1 -u admin --password account list
ERROR:element.cli.cli:list is not a valid module. Please run 'sfcli --help' for a list of valid modules.

This error made me run sfcli --help more than once... Obviously the problem is that I forgot to provide the password, but I got confused (ERROR:element.cli.cli:list looks like some internal string that's not supposed to appear in output; I didn't even realize that list in that string is what I entered above - in my mind was using "account", not "list"). I ended up reading module help pages, looking for spelling mistakes, etc. Of course "list" is not a module, but that's easy to miss [1].

Ideas:

  • Add a space between ERROR:element.cli.cli: and the invalid module name (that should be enough)
  • (Optional) Format the "invalid module" error message to look visually similar to "invalid command" (below). Maybe \nUsage: please run 'sfcli --help'?
  • (Completely optional) In this case (correct module name, missing password) before we throw this "invalid module" error, we could match the provided password against the list of all sfcli modules and then check if the following word is a command name. If the supposed password parameter is a sfcli module and the next word is a command name, then (--password account list) could result in a better error, such as "list is not a valid module or password is likely missing". Maybe this is too much trouble, though.

[1] Compare the visual appearance of wrong command error (vs. wrong module, at the top)

sfcli -m 1.1.1.1 -u admin --password password account getbyids
Usage: sfcli account [OPTIONS] COMMAND [ARGS]...

Error: No such command "getbyids".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant