use std::str::FromStr;
use crate::OutputFormatParseError;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum OutputFormat {
Text,
Yaml,
#[cfg(feature = "output_json")]
Json,
}
impl FromStr for OutputFormat {
type Err = OutputFormatParseError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"text" => Ok(Self::Text),
"yaml" => Ok(Self::Yaml),
#[cfg(feature = "output_json")]
"json" => Ok(Self::Json),
_ => Err(OutputFormatParseError(s.to_string())),
}
}
}