improve msg arg/handlers + tpl + flag

This commit is contained in:
Clément DOUIN
2021-09-16 19:28:08 +02:00
parent bc5f9045ce
commit 54493540b4
17 changed files with 1201 additions and 1031 deletions
+18
View File
@@ -12,6 +12,15 @@ pub enum OutputFmt {
Json,
}
impl From<&str> for OutputFmt {
fn from(fmt: &str) -> Self {
match fmt {
slice if slice.eq_ignore_ascii_case("json") => Self::Json,
_ => Self::Plain,
}
}
}
impl TryFrom<Option<&str>> for OutputFmt {
type Error = Error;
@@ -99,6 +108,15 @@ impl Default for OutputService {
}
}
impl From<&str> for OutputService {
fn from(fmt: &str) -> Self {
debug!("init output service");
debug!("output: `{:?}`", fmt);
let fmt = fmt.into();
Self { fmt }
}
}
impl TryFrom<Option<&str>> for OutputService {
type Error = Error;