canonical / canonical/craft-cli
Better output information when requesting help for a command with bad arguments for that command
- Dominant language
- Python
- Stars
- 16
- Forks
- 27
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 10
Description
It's typical the following situation: Try to run a command with bad args...
```
myapp somecommand --bad-args
```
...and then, when failed, ask for help on that:
```
myapp help somecommand --bad-args
```
Currently it fails because `--bad-args` is not really a valid argument for the help command. Real life example:
```
$ charmcraft help close --bad-args
Usage: charmcraft [options] command [args]...
Try 'charmcraft -h' for help.
Error: Too many parameters when requesting help; pass a command, '--all', or leave it empty
```
It should detect that the first given parameter is actually a command name, and it should provide help for that command, no matter the invalid posterior options. Expected:
```
$ charmcraft help close --bad-args
Usage:
charmcraft close [options]
Summary:
...
```
Contributor guide
Research direction
Reproduce the behavior with `myapp help somecommand --bad-args` and trace the help-command argument handling. Confirm how the first parameter is resolved as a command and how later invalid options are treated, then add coverage for the reported example and verify that help for `somecommand` is shown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100