2022-10-25 16:32:36 -07:00
|
|
|
use super::*;
|
|
|
|
|
2022-10-31 00:52:03 -07:00
|
|
|
#[derive(
|
|
|
|
EnumString, PartialEq, Debug, Copy, Clone, Serialize, Ord, PartialOrd, Eq, IntoStaticStr,
|
|
|
|
)]
|
|
|
|
#[strum(serialize_all = "kebab-case")]
|
|
|
|
#[serde(rename_all = "kebab-case")]
|
2022-10-25 16:32:36 -07:00
|
|
|
pub(crate) enum Attribute {
|
2023-11-16 15:51:34 -08:00
|
|
|
Confirm,
|
2022-10-31 00:52:03 -07:00
|
|
|
Linux,
|
|
|
|
Macos,
|
2022-11-02 23:37:35 -07:00
|
|
|
NoCd,
|
2022-10-25 16:32:36 -07:00
|
|
|
NoExitMessage,
|
2022-11-22 16:25:57 -08:00
|
|
|
Private,
|
2024-01-12 12:38:23 -08:00
|
|
|
NoQuiet,
|
2022-10-31 00:52:03 -07:00
|
|
|
Unix,
|
|
|
|
Windows,
|
2022-10-25 16:32:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Attribute {
|
|
|
|
pub(crate) fn from_name(name: Name) -> Option<Attribute> {
|
|
|
|
name.lexeme().parse().ok()
|
|
|
|
}
|
2022-10-31 00:52:03 -07:00
|
|
|
|
|
|
|
pub(crate) fn to_str(self) -> &'static str {
|
|
|
|
self.into()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
mod tests {
|
|
|
|
use super::*;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn to_str() {
|
|
|
|
assert_eq!(Attribute::NoExitMessage.to_str(), "no-exit-message");
|
|
|
|
}
|
2022-10-25 16:32:36 -07:00
|
|
|
}
|