use clap::ValueEnum;
use clap::builder::OsStr;
use rusty_viking::EnumDisplay;
use std::ffi::OsString;
#[derive(Debug, Default, PartialEq, Eq, Clone, Copy, ValueEnum, EnumDisplay)]
#[Lower]
pub enum Suppress {
#[default]
None,
Git,
Cargo,
All,
}
impl Suppress {
#[must_use]
pub fn is_none(&self) -> bool {
matches!(self, Self::None)
}
#[must_use]
pub fn is_git(&self) -> bool {
matches!(self, Self::Git)
}
#[must_use]
pub fn includes_git(&self) -> bool {
matches!(self, Self::Git | Self::All)
}
#[must_use]
pub fn is_cargo(&self) -> bool {
matches!(self, Self::Cargo)
}
#[must_use]
pub fn includes_cargo(&self) -> bool {
matches!(self, Self::Cargo | Self::All)
}
#[must_use]
pub fn is_all(&self) -> bool {
matches!(self, Self::All)
}
}
impl From<Suppress> for OsStr {
fn from(suppress: Suppress) -> Self {
let string_rep = OsString::from(suppress.to_string());
Self::from(string_rep)
}
}