[clap] Rename ValueEnum enum values

Is it possible to manually specify the name of enum values?

Something along the line of:

#[derive(Debug, Clone, ValueEnum)]
pub enum KeyTypes {
  #[something(rename_to="hello")]
  Rsa4096,
  #[something(rename_to="world")]
  EcSecp521r1,
  #[something(rename_to="foobar")]
  Ed25519
}

I.e. I'm not looking for rename_all (to change the convention of naming the members), but I would like to change how they are referred in the help text and by the user.

ValueEnum attribute reference says name = "name".

1 Like