canonical / canonical/craft-cli

Always report error messages for incorrect usage

Open
#262 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
16
Forks
27
Avg merge
2d 1h
Merged PRs (30d)
12

Description

### 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.