use std::path::PathBuf;
#[derive(Debug, Clone)]
pub enum ZvDirAction {
NotSet,
MakePermanent { current_path: PathBuf },
AlreadyPermanent,
}
#[derive(Debug, Clone)]
pub enum PathAction {
AlreadyConfigured,
AddToRegistry { bin_path: PathBuf },
GenerateEnvFile {
env_file_path: PathBuf,
rc_file: PathBuf,
bin_path: PathBuf,
},
}
impl ZvDirAction {
pub fn requires_user_interaction(&self) -> bool {
matches!(self, ZvDirAction::MakePermanent { .. })
}
pub fn modifies_system(&self) -> bool {
matches!(self, ZvDirAction::MakePermanent { .. })
}
}
impl PathAction {
pub fn modifies_system(&self) -> bool {
!matches!(self, PathAction::AlreadyConfigured)
}
pub fn bin_path(&self) -> Option<&PathBuf> {
match self {
PathAction::AlreadyConfigured => None,
PathAction::AddToRegistry { bin_path } => Some(bin_path),
PathAction::GenerateEnvFile { bin_path, .. } => Some(bin_path),
}
}
}