oras-project / oras

OCI registry client - managing content like artifacts, images, packages
https://oras.land
Apache License 2.0
1.33k stars 160 forks source link

Need to improve error message when basic auth flags are used with identity token flags #1340

Closed wangxiaoxuan273 closed 2 months ago

wangxiaoxuan273 commented 2 months ago

After #1294 is completed, cmd.MarkFlagsMutuallyExclusive is used to prevent --identity-token / --identity-token-stdin to be used with --username/ --password / --password-stdin. However, the default error message is confusing for the users. We need to improve the error messages.

shizhMSFT commented 2 months ago

@wangxiaoxuan273 Can you note down the current error message in this issue?

wangxiaoxuan273 commented 2 months ago

Current error message: Error: if any flags in the group [password identity-token identity-token-stdin password-stdin] are set none of the others can be; [identity-token password] were all set

Screenshot 2024-04-12 at 16 45 53
qweeah commented 2 months ago

Also need to improve MarkFlagsRequiredTogether as it's used by mTLS flag parsing.

qweeah commented 2 months ago

The returned error should be compliant to the error guideline proposed in https://github.com/oras-project/oras/pull/1163