depl 2.4.3

Toolkit for a bunch of local and remote CI/CD actions
Documentation
//! Automatic rule to extract version module.

use serde::{Deserialize, Serialize};
use std::path::PathBuf;

use crate::entities::custom_command::CustomCommand;

/// Rule to extract version from the project automatically.
#[derive(Deserialize, Serialize, PartialEq, Eq, PartialOrd, Ord, Clone)]
#[serde(tag = "type", rename_all = "snake_case")]
#[allow(missing_docs)]
pub enum AutoVersionExtractFromRule {
  /// Extract from `stdout` of command.
  CmdStdout { cmd: CustomCommand },
  /// Extract from plain file.
  PlainFile { path: PathBuf },
}

impl AutoVersionExtractFromRule {
  /// Returns rule type as `&str`.
  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",
    }
  }
}