I have a simple example on the Playground:
use clap; // 4.5.4
use clap::{Parser, ValueEnum};
#[derive(Debug, Clone, Parser)]
pub struct Args {
/// The target environment
#[arg(long = "env", hide_possible_values = false)]
pub env: Env,
}
#[derive(Debug, Clone, ValueEnum)]
pub enum Env {
// FIXME how do I unhide this alias?
/// dev environment
#[value(alias("dev"), hide = false)]
Development,
// FIXME how do I unhide this alias?
/// prod environment
#[value(alias("prod"), hide = false)]
Production,
}
fn main() {
Args::parse_from(&[std::env::args().nth(0).unwrap().as_str(), "--help"]);
}
Running this does not show the aliases:
Usage: playground --env <ENV>
Options:
--env <ENV>
The target environment
Possible values:
- development: dev environment
- production: prod environment
-h, --help
Print help (see a summary with '-h')
I want the aliases that I am specifying to show up in the --help
docs, but I can't seem to find a way to make this possible.
Is there a way to "unhide" the aliases so they show up?