cosign icon indicating copy to clipboard operation
cosign copied to clipboard

*Any* CLI invocation with `--help` in it or beginning with `cosign help` should give me help text

Open znewman01 opened this issue 3 years ago • 1 comments
trafficstars

If I have an unknown flag in my CLI arguments, cosign fails no matter how hard I tell it that I want help:

$ cosign sign --bundle foo --help
Error: unknown flag: --bundle
main.go:46: error during command execution: unknown flag: --bundle
$ cosign sign --help --bundle foo
Error: unknown flag: --bundle
main.go:46: error during command execution: unknown flag: --bundle
$ cosign help sign --help --bundle foo
Error: unknown flag: --bundle
main.go:46: error during command execution: unknown flag: --bundle
$ cosign help sign --help --bundle foo --help
Error: unknown flag: --bundle
main.go:46: error during command execution: unknown flag: --bundle

I have to delete the flag that doesn't exist. This is particularly frustrating if I'm not sure about the spelling of a flag, and I have to put it back after.

I like clig.dev on this:

Ignore any other flags and arguments that are passed—you should be able to add -h to the end of anything and it should show help. Don’t overload -h.

Similarly, cosign help sign --etc should ignore all the flags (including --output-file and --verbose IMO).

If we're messing with help behavior, I'd also echo their point about showing help for cosign sign with no arguments:

Display help text when passed no options [emphasis added], the -h flag, or the --help flag.

$ cosign sign
Error: requires at least 1 arg(s), only received 0
main.go:46: error during command execution: requires at least 1 arg(s), only received 0

znewman01 avatar May 02 '22 13:05 znewman01

related to https://github.com/sigstore/cosign/issues/1811

cpanato avatar May 02 '22 13:05 cpanato