Add diff command to show unstaged changes in a session's worktree
This commit is contained in:
parent
37136f5e04
commit
3c77c43999
21
src/cli.ts
21
src/cli.ts
|
|
@ -225,6 +225,27 @@ program
|
|||
spin.succeed(`Saved: ${msg}`)
|
||||
})
|
||||
|
||||
// ── sandlot diff <branch> ───────────────────────────────────────────
|
||||
|
||||
program
|
||||
.command("diff")
|
||||
.argument("<branch>", "branch name")
|
||||
.description("Show unstaged changes in a session's worktree")
|
||||
.action(async (branch: string) => {
|
||||
const root = await git.repoRoot()
|
||||
const session = await state.getSession(root, branch)
|
||||
if (!session) {
|
||||
console.error(`No session found for branch "${branch}".`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const result = await $`git -C ${session.worktree} diff`.nothrow()
|
||||
if (result.exitCode !== 0) {
|
||||
console.error("git diff failed")
|
||||
process.exit(1)
|
||||
}
|
||||
})
|
||||
|
||||
// ── sandlot vm ───────────────────────────────────────────────────────
|
||||
|
||||
const vmCmd = program.command("vm").description("Manage the sandlot VM")
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user