35 lines
858 B
TypeScript
35 lines
858 B
TypeScript
import { Session } from "../../../session"
|
|
import { Snapshot } from "../../../snapshot"
|
|
import { bootstrap } from "../../bootstrap"
|
|
import { cmd } from "../cmd"
|
|
|
|
export const SnapshotCommand = cmd({
|
|
command: "snapshot",
|
|
builder: (yargs) => yargs.command(TrackCommand).command(PatchCommand).demandCommand(),
|
|
async handler() {},
|
|
})
|
|
|
|
const TrackCommand = cmd({
|
|
command: "track",
|
|
async handler() {
|
|
await bootstrap({ cwd: process.cwd() }, async () => {
|
|
console.log(await Snapshot.track())
|
|
})
|
|
},
|
|
})
|
|
|
|
const PatchCommand = cmd({
|
|
command: "patch <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.patch(args.hash))
|
|
})
|
|
},
|
|
})
|