refactor(command_parser): move parameter fmt to Parameter types Display impl

This commit is contained in:
dusk 2025-01-24 05:16:15 +09:00
parent 58d493ac0a
commit e3778b9bb8
No known key found for this signature in database
3 changed files with 43 additions and 36 deletions

View file

@ -2,7 +2,7 @@ use std::fmt::Display;
use smol_str::SmolStr;
use crate::parameter::{ParameterKind, ParameterValue};
use crate::parameter::{Parameter, ParameterKind, ParameterValue};
#[derive(Debug)]
pub enum FlagValueMatchError {
@ -22,7 +22,7 @@ impl Display for Flag {
write!(f, "-{}", self.name)?;
if let Some(value) = self.value.as_ref() {
write!(f, "=")?;
value.format(f, value.default_name())?;
Parameter::from(*value).fmt(f)?;
}
Ok(())
}