use serde::{Deserialize, Serialize};
use std::path::PathBuf;
use crate::entities::custom_command::CustomCommand;
#[derive(Deserialize, Serialize, PartialEq, Eq, PartialOrd, Ord, Clone)]
#[serde(tag = "type", rename_all = "snake_case")]
#[allow(missing_docs)]
pub enum AutoVersionExtractFromRule {
CmdStdout { cmd: CustomCommand },
PlainFile { path: PathBuf },
}
impl AutoVersionExtractFromRule {
pub fn type_str(&self) -> &str {
match self {
Self::CmdStdout { cmd: _ } => "execute the command and get output from `stdout` as version",
Self::PlainFile { path: _ } => "get a version from specified plain file",
}
}
}