-
Hi, Is it possible to specify args from a subcommand in a require in a parent arg? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
At the moment, no. Subcommands are scoped and we do not have a special syntax for accessing that scope. We are talking about making clap's API more open ended with users being able to provide custom trait implementations for different parts of the process (lexing, parsing/validating a value, help generation, etc). We haven't started to map out what this would look like for the validation rules like In the mean time, clap3 exposes an |
Beta Was this translation helpful? Give feedback.
At the moment, no. Subcommands are scoped and we do not have a special syntax for accessing that scope.
We are talking about making clap's API more open ended with users being able to provide custom trait implementations for different parts of the process (lexing, parsing/validating a value, help generation, etc). We haven't started to map out what this would look like for the validation rules like
requires
but that might be a future possibility.In the mean time, clap3 exposes an
App::error
function to allow users to do their own post-parse validation while creating an error message that looks like one from clap.