Problem with excluents args in Clap

Supervise {
        #[arg(long)]
        file: PathBuf,

        #[cfg(feature = "etcd")]
        #[arg(long, value_parser = parse_socket_addr, conflicts_with("file"))]
        etcd: Option<SocketAddr>,
    },

Hi, im having some problem with clap, bc i want both these args to be excluents, but one of them being conditionaly compiled is making things hard, i want at least one to be used, but cant use both, if i put the file as is, im required to use file use even when using etcd. If i put file as Option<>, both wont be required. If etcd is not Option<>, Clap makes me have to use both, even with the conflicts_with("file"). And when i try to use both, i have this panic:
image

the best would be to have conflicts_with("file") as conditionaly compiled, but this is impossible, i tried with groups also, but cant be conditional also.

Maybe try applying required_unless_present on both fields?

What you need is an ArgGroup.

#[derive(clap::Parser, Debug)]
enum Cli {
    Supervise(Input),
}

#[derive(clap::Args, Debug)]
#[group(required = true, multiple = false)]
struct Input {
    #[arg(long)]
    file: Option<PathBuf>,

    #[cfg(feature = "etcd")]
    #[arg(long)]
    etcd: Option<String>,
}