mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-06 11:35:45 +00:00
oof: impl fmt::Display for Flag
This commit is contained in:
parent
c08eb91632
commit
5cca3c42e4
@ -29,6 +29,15 @@ pub struct Flag {
|
||||
pub takes_value: bool,
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Flag {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self.short {
|
||||
Some(short_flag) => write!(f, "-{}, --{}", short_flag, self.long),
|
||||
None => write!(f, "--{}", self.long),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Flag {
|
||||
pub fn long(name: &'static str) -> Self {
|
||||
Self {
|
||||
|
Loading…
x
Reference in New Issue
Block a user