use std::fmt::{Display, Formatter};
use std::string::String;
#[derive(Default, Clone)]
pub struct Arg {
pub(crate) id: String,
pub(crate) short_name: char,
pub(crate) long_name: String,
pub(crate) need: bool,
pub(crate) desc:String,
pub(crate) default: String,
}
impl Arg {
pub fn new(id: &str) -> Self {
Arg::default().id(id)
}
#[must_use]
pub fn id(mut self, id: &str) -> Self {
self.id = String::from(id);
self
}
#[must_use]
pub fn short_name(mut self, s: char) -> Self {
debug_assert!(s!='-',"short option name cannot be `-`");
self.short_name = s;
self
}
#[must_use]
pub fn long_name(mut self, s: &str) -> Self {
self.long_name = s.parse().unwrap();
self
}
}
impl Display for Arg {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "")
}
}