pub mod string_extensions;
pub mod path_extensions;
pub mod git;
pub mod errors;
pub mod constants;
use std::path::PathBuf;
use clap::ValueEnum;
pub use path_extensions::PathBufExtensions;
use crate::utils::constants::CD_MARKER;
#[derive(Debug)]
pub enum Return {
Null {},
Cd { path: PathBuf }
}
impl Return {
pub fn print(&self) -> String {
match self {
Return::Null { .. } => "".to_string(),
Return::Cd { path } => format!("{}{}", CD_MARKER, path.display())
}
}
}
#[derive(ValueEnum, Debug, Clone)]
pub enum Shell {
Bash,
Zsh
}
impl Shell {
pub fn from_str(s: &str) -> Result<Self, String> {
match s.to_lowercase().as_str() {
"bash" => Ok(Shell::Bash),
"zsh" => Ok(Shell::Zsh),
_ => Err(format!("Unknown shell: {}", s))
}
}
}