#![cfg_attr(feature = "fail-on-warnings", deny(warnings))]
#![warn(clippy::all, clippy::pedantic, clippy::nursery, clippy::cargo)]
#![allow(clippy::multiple_crate_versions)]
use std::path::PathBuf;
use clap::Parser;
#[derive(Debug, Parser)]
#[command(
name = "worktree-setup",
about = "Set up git worktrees with project-specific configurations",
version
)]
pub struct Args {
#[arg(index = 1)]
pub target_path: Option<PathBuf>,
#[arg(long)]
pub branch: Option<String>,
#[arg(long)]
pub new_branch: Option<String>,
#[arg(long = "config", short = 'c')]
pub configs: Vec<String>,
#[arg(long = "no-install")]
pub no_install: bool,
#[arg(long)]
pub unstaged: bool,
#[arg(long = "no-unstaged")]
pub no_unstaged: bool,
#[arg(long)]
pub list: bool,
#[arg(long)]
pub non_interactive: bool,
#[arg(long = "no-progress")]
pub no_progress: bool,
#[arg(long, short = 'v')]
pub verbose: bool,
}
impl Args {
#[must_use]
pub fn copy_unstaged_override(&self) -> Option<bool> {
if self.no_unstaged {
Some(false)
} else if self.unstaged {
Some(true)
} else {
None
}
}
#[must_use]
pub fn should_run_install(&self) -> bool {
!self.no_install
}
#[must_use]
pub fn should_show_progress(&self) -> bool {
!self.no_progress
}
}