RFR: 1275: An unknown sub-command gives a confusing error message [v2]

Guoxiong Li gli at openjdk.java.net
Thu Dec 9 15:03:39 UTC 2021


> Hi all,
>
> When using the unknown command, the client will output the unexpected message. For example:
>
>
> $ git-pr lis 123
>
> error: unexpected input: 123
> usage: git-pr [options] [<COMMAND>]
> 	-h, --help      Show help
> 	    --verbose   Turn on verbose output
> 	    --debug     Turn on debugging output
> 	    --version   Print the version of this tool
>
>
> When the client can't identify the sub-command `git-pr lis`, it will execute the default command `git-pr help` and will pass `lis 123` as the argument to the `git-pr help` command. And the `git-pr help` can resolve only one argument, which is `lis` in this example, so it would output `error: unexpected input: 123`.
>
> This patch will output more information to the user:
>
>
> $ git-pr lis 123
>
> Can't find the sub-command 'lis', the default sub-command 'help' will be executed.
> The arguments [lis, 123] will be passed to the default sub-command.
>
> error: unexpected input: 123
> usage: git-pr [options] [<COMMAND>]
> 	-h, --help      Show help
> 	    --verbose   Turn on verbose output
> 	    --debug     Turn on debugging output
> 	    --version   Print the version of this tool
>
>
> The added information can let the user know why the following output is shown.
>
> Thanks for taking the time to review.
>
> Best Regards,
> -- Guoxiong

Guoxiong Li has updated the pull request incrementally with one additional commit since the last revision:

Adjust the message. Excluded the 'git-webrev'.

-------------

Changes:
- all: https://git.openjdk.java.net/skara/pull/1257/files
- new: https://git.openjdk.java.net/skara/pull/1257/files/6efb2e9b..6e40540d

Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=skara&pr=1257&range=01
- incr: https://webrevs.openjdk.java.net/?repo=skara&pr=1257&range=00-01

Stats: 5 lines in 1 file changed: 1 ins; 0 del; 4 mod
Patch: https://git.openjdk.java.net/skara/pull/1257.diff
Fetch: git fetch https://git.openjdk.java.net/skara pull/1257/head:pull/1257

PR: https://git.openjdk.java.net/skara/pull/1257



More information about the skara-dev mailing list