How to validate and generate error message based on neighbor option ? #5716
-
Hello, I'm working on a CLI for parsec-cloud. I would like to know if it is possible to validate an argument/option based on another one. The scenario is like the following: We have a CLI that take 2 options:
The struct opt would look like something: #[derive(clap::Parser)
struct Opts {
#[arg(long)]
config_dir: PathBuf,
#[arg(long)]
device_id: Uuid,
} The
Currently we are able to do that outside of
I've tried to take a look at |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
We do not currently have support for this.
We are exploring more custom validation options in #2763 but overall I suspect doing it on your side will provide the best results. |
Beta Was this translation helpful? Give feedback.
We do not currently have support for this.
TypedValueParser
is run too early for this. We process those as we are parsing and so we don't have the full command-line available.We are exploring more custom validation options in #2763 but overall I suspect doing it on your side will provide the best results.