clikt icon indicating copy to clipboard operation
clikt copied to clipboard

Print all the missing options in the error message

Open vlsi opened this issue 1 year ago • 0 comments

Thanks for the library! I'm using it to drive Bugzilla -> GitHub issues conversion tool: https://github.com/vlsi/bugzilla2github

I noticed that currently Clikt prints only the first The current behavior is Clikt stops at the first missing option, so the user has to re-run the command adding options one by one.

It would be nice if Clikt could collect and print all the failures at once (missing options, invalid values, etc)

class ManyOpts: NoOpCliktCommand() {
    val int by option().int().required()
    val string by option().required()
}
$ .. many-opts

Usage: root many-opts [OPTIONS]

Error: Missing option "--int"

I would expect that the error message would include all the missing options rather than just the first.

$ .. many-opts --int=1

Usage: root many-opts [OPTIONS]

Error: Missing option "--string"

So the user has to add options one-by-one.

The same goes when there's an error (it would be nice for the error message to include all the missing required options and all the options that can't be parsed):

$ .. many-opts --int=undefined

Usage: root many-opts [OPTIONS]

Error: Invalid value for "--int": undefined is not a valid integer

vlsi avatar Aug 03 '22 07:08 vlsi