coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

Use `clap::ArgAction` in `true` and `false`

Open jarkonik opened this issue 3 years ago • 2 comments

Closes #3769

jarkonik avatar Aug 06 '22 14:08 jarkonik

Seems like using .action(ArgAction::Help) on clap command builder cancels command conflict validation set with .exclusive(true). Probably should be fixed upstream.

jarkonik avatar Aug 06 '22 17:08 jarkonik

Oh that's unfortunate. Could you make an issue in the clap repo with a minimal reproduction?

tertsdiepraam avatar Aug 06 '22 18:08 tertsdiepraam

On second thought, I wonder if exclusive is the right thing to do here. Maybe we should just check whether the the number of arguments (i.e. argc) is 2 and check for --help and --versiononly if that's the case.

tertsdiepraam avatar Aug 15 '22 08:08 tertsdiepraam

Given the outcome of the issue on clap, I think my previous comment is the right way forward.

tertsdiepraam avatar Aug 15 '22 16:08 tertsdiepraam

I've reimplemented the behaviour using argument count instead of exclusive flag as suggested

jarkonik avatar Aug 15 '22 17:08 jarkonik