mirror of
https://github.com/pimalaya/himalaya.git
synced 2026-06-17 21:37:55 +08:00
improve msg arg/handlers + tpl + flag
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user