Skip to content

Commit c2dc228

Browse files
committed
Add patchable commands for getting the current patch and worktree dirs
1 parent 6d09f6d commit c2dc228

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

rust/patchable/src/main.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,20 @@ enum Cmd {
147147
#[clap(long)]
148148
base: String,
149149
},
150+
151+
/// Shows the patch directory for a given product version
152+
PatchDir {
153+
#[clap(flatten)]
154+
pv: ProductVersion,
155+
},
156+
157+
/// Shows the worktree directory for a given product version
158+
///
159+
/// This is the same value as `cargo patchable checkout` returns, but does not perform a checkout.
160+
WorktreeDir {
161+
#[clap(flatten)]
162+
pv: ProductVersion,
163+
},
150164
}
151165

152166
#[derive(Debug, Snafu)]
@@ -411,6 +425,22 @@ fn main() -> Result<()> {
411425
"created configuration for product version"
412426
);
413427
}
428+
429+
Cmd::PatchDir { pv } => {
430+
let ctx = ProductVersionContext {
431+
pv,
432+
images_repo_root,
433+
};
434+
println!("{}", ctx.patch_dir().display());
435+
}
436+
437+
Cmd::WorktreeDir { pv } => {
438+
let ctx = ProductVersionContext {
439+
pv,
440+
images_repo_root,
441+
};
442+
println!("{}", ctx.worktree_root().display());
443+
}
414444
}
415445

416446
Ok(())

0 commit comments

Comments
 (0)