Add commands to manage worktrees
This commit is contained in:
27
src/cmd.rs
27
src/cmd.rs
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user