use std::path::{Path, PathBuf};
#[derive(Clone, Debug, Default)]
pub struct RmOpts {
pub paths: Vec<PathBuf>,
pub staged: bool,
pub recursive: bool,
}
impl RmOpts {
pub fn from_path<P: AsRef<Path>>(path: P) -> RmOpts {
RmOpts {
paths: vec![path.as_ref().to_owned()],
staged: false,
recursive: false,
}
}
pub fn from_staged_path<P: AsRef<Path>>(path: P) -> RmOpts {
RmOpts {
paths: vec![path.as_ref().to_owned()],
staged: true,
recursive: false,
}
}
pub fn from_path_recursive<P: AsRef<Path>>(path: P) -> RmOpts {
RmOpts {
paths: vec![path.as_ref().to_owned()],
staged: false,
recursive: true,
}
}
}