Traefik-style .
separated flag categories
#4699
Replies: 1 comment 9 replies
-
This sounds like a more static version of #4198. With #2621, this would look something like #[derive(clap::Parse)]
struct Cli {
#[command(flatten)]
providers: Providers,
}
#[derive(clap::Args)]
pub enum Providers {
Docker {
#[arg(long = "providers.docker.endpoint")]
endpoint: Option<Url>,
#[arg(long = "providers.docker.swamMode")]
swarm_mode: bool,
},
Kubernetescrd {
#[arg(long = "providers.kubernetescrd.endpoint")]
endpoint: Option<Url>,
#[arg(long = "providers.kubernetescrd.token")]
token: Option<String>,
}
} Which also makes me realize that for #2621, we should make the implicit Another interesting aspect your use case brings up is what ti do if no flags are specified. |
Beta Was this translation helpful? Give feedback.
-
It would be nice if clap had a way to support traefik style flag argument categories which allow you to cleanly separate categories of flags. This would also work well with enums of structs which is currently not supported in the clap derive.
Examples
CLI
Rust Derive
Beta Was this translation helpful? Give feedback.
All reactions