diff --git a/keyfork/src/cli/mnemonic.rs b/keyfork/src/cli/mnemonic.rs index 2fa9b88..685e3a2 100644 --- a/keyfork/src/cli/mnemonic.rs +++ b/keyfork/src/cli/mnemonic.rs @@ -1,5 +1,5 @@ use super::Keyfork; -use clap::{Parser, Subcommand, ValueEnum}; +use clap::{Parser, Subcommand, ValueEnum, builder::PossibleValue}; use std::fmt::Display; #[derive(Clone, Debug, Default)] @@ -10,6 +10,20 @@ pub enum SeedSize { Bits256, } +// custom impl to override names in ValueEnum +impl ValueEnum for SeedSize { + fn value_variants<'a>() -> &'a [Self] { + &[Self::Bits128, Self::Bits256] + } + + fn to_possible_value(&self) -> Option { + Some(PossibleValue::new(match self { + SeedSize::Bits128 => "128", + SeedSize::Bits256 => "256", + })) + } +} + #[derive(thiserror::Error, Debug, Clone)] pub enum SeedSizeError { #[error("Expected one of 128, 256")]