canonical / craft-cli

https://canonical-craft-cli.readthedocs-hosted.com/en/latest/
GNU Lesser General Public License v3.0
9 stars 15 forks source link

Always report error messages for incorrect usage #262

Open mattculler opened 1 month ago

mattculler commented 1 month ago

What needs to get done

Most CLI usage errors output exactly what I would expect - a basic usage line, suggestion to consult -h, and an error message:

$ corncraft foo
Usage: corncraft [options] command [args]...
Try 'corncraft -h' for help.

Error: no such command 'foo'

$ corncraft pack --foo
Usage: corncraft [options] command [args]...
Try 'corncraft pack -h' for help.

Error: unrecognized arguments: --foo

But passing no command at all will instead output the help text, with no explanation. (It does return nonzero.) The "no command specified" case should get its own message.

In my view, even a generic error message would be better than the help text, which is annoying - I would argue that we should also change the case where help output is displayed in response to a generic error.

Why it needs to get done

This will likely be confusing for new users.

syncronize-issues-to-jira[bot] commented 1 month ago

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-3119.

This message was autogenerated