Add commands to manage worktrees

This commit is contained in:
2021-11-21 17:07:38 +01:00
parent b0746c95b5
commit 09f22edf49
3 changed files with 145 additions and 1 deletions

View File

@@ -28,6 +28,12 @@ pub enum SubCommand {
Find(Find),
#[clap(about = "Show status of configured repositories")]
Status(OptionalConfig),
#[clap(
visible_alias = "wt",
about = "Manage worktrees"
)]
Worktree(Worktree),
}
#[derive(Parser)]
@@ -55,6 +61,27 @@ pub struct Find {
pub path: String,
}
#[derive(Parser)]
pub struct Worktree {
#[clap(subcommand, name = "action")]
pub action: WorktreeAction,
}
#[derive(Parser)]
pub enum WorktreeAction {
#[clap(about = "Add a new worktree")]
Add(WorktreeActionArgs),
#[clap(about = "Add an existing worktree")]
Delete(WorktreeActionArgs),
}
#[derive(Parser)]
pub struct WorktreeActionArgs {
#[clap(about = "Name of the worktree")]
pub name: String,
}
pub fn parse() -> Opts {
Opts::parse()
}