use clap::ValueHint;
#[derive(clap::Args, Default, Debug)]
#[clap(next_help_heading = "Git Options")]
pub struct GitOptions {
#[clap(short = 'C', num_args = 1, value_hint=ValueHint::DirPath)]
pub change_dir: Option<String>,
#[clap(long, value_hint=ValueHint::DirPath)]
pub git_dir: Option<String>,
#[clap(long, value_hint=ValueHint::DirPath)]
pub work_tree: Option<String>,
}
#[cfg(feature = "git-wrapper")]
impl TryFrom<&GitOptions> for git_wrapper::Repository {
type Error = git_wrapper::RepoError;
#[inline]
fn try_from(args: &GitOptions) -> Result<Self, Self::Error> {
Self::from_args(
args.change_dir.as_deref(),
args.git_dir.as_deref(),
args.work_tree.as_deref(),
)
}
}