treeflow 0.1.9

CLI tool for simplified Git worktree management to speed up switching contexts when working collaboratively.
Documentation
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
}

impl Shell {
    pub fn from_str(s: &str) -> Result<Self, String> {
        match s.to_lowercase().as_str() {
            "bash" => Ok(Shell::Bash),
            _ => Err(format!("Unknown shell: {}", s))
        }
    }
}