2025-07-01 16:06:38 +00:00
|
|
|
import { Snapshot } from "../../../snapshot"
|
|
|
|
|
import { bootstrap } from "../../bootstrap"
|
|
|
|
|
import { cmd } from "../cmd"
|
|
|
|
|
|
|
|
|
|
export const SnapshotCommand = cmd({
|
|
|
|
|
command: "snapshot",
|
2025-07-28 17:00:09 +00:00
|
|
|
builder: (yargs) => yargs.command(TrackCommand).command(PatchCommand).command(DiffCommand).demandCommand(),
|
2025-07-01 16:06:38 +00:00
|
|
|
async handler() {},
|
|
|
|
|
})
|
|
|
|
|
|
2025-07-24 21:34:15 +00:00
|
|
|
const TrackCommand = cmd({
|
|
|
|
|
command: "track",
|
2025-07-01 16:06:38 +00:00
|
|
|
async handler() {
|
|
|
|
|
await bootstrap({ cwd: process.cwd() }, async () => {
|
2025-07-24 21:34:15 +00:00
|
|
|
console.log(await Snapshot.track())
|
2025-07-01 16:06:38 +00:00
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
})
|
2025-07-14 18:44:47 +00:00
|
|
|
|
2025-07-24 21:34:15 +00:00
|
|
|
const PatchCommand = cmd({
|
|
|
|
|
command: "patch <hash>",
|
2025-07-14 18:44:47 +00:00
|
|
|
builder: (yargs) =>
|
2025-07-24 21:34:15 +00:00
|
|
|
yargs.positional("hash", {
|
2025-07-14 18:44:47 +00:00
|
|
|
type: "string",
|
2025-07-24 21:34:15 +00:00
|
|
|
description: "hash",
|
2025-07-14 18:44:47 +00:00
|
|
|
demandOption: true,
|
|
|
|
|
}),
|
|
|
|
|
async handler(args) {
|
|
|
|
|
await bootstrap({ cwd: process.cwd() }, async () => {
|
2025-07-24 21:34:15 +00:00
|
|
|
console.log(await Snapshot.patch(args.hash))
|
2025-07-24 00:30:46 +00:00
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
})
|
2025-07-28 17:00:09 +00:00
|
|
|
|
|
|
|
|
const DiffCommand = cmd({
|
|
|
|
|
command: "diff <hash>",
|
|
|
|
|
builder: (yargs) =>
|
|
|
|
|
yargs.positional("hash", {
|
|
|
|
|
type: "string",
|
|
|
|
|
description: "hash",
|
|
|
|
|
demandOption: true,
|
|
|
|
|
}),
|
|
|
|
|
async handler(args) {
|
|
|
|
|
await bootstrap({ cwd: process.cwd() }, async () => {
|
|
|
|
|
console.log(await Snapshot.diff(args.hash))
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
})
|