f884766445
Co-authored-by: GitHub Action <action@github.com> Co-authored-by: Liang-Shih Lin <liangshihlin@proton.me> Co-authored-by: Dominik Engelhardt <dominikengelhardt@ymail.com> Co-authored-by: Jay V <air@live.ca> Co-authored-by: adamdottv <2363879+adamdottv@users.noreply.github.com>
36 lines
940 B
TypeScript
36 lines
940 B
TypeScript
import { Snapshot } from "../../../snapshot"
|
|
import { bootstrap } from "../../bootstrap"
|
|
import { cmd } from "../cmd"
|
|
|
|
export const SnapshotCommand = cmd({
|
|
command: "snapshot",
|
|
builder: (yargs) => yargs.command(SnapshotCreateCommand).command(SnapshotRestoreCommand).demandCommand(),
|
|
async handler() {},
|
|
})
|
|
|
|
export const SnapshotCreateCommand = cmd({
|
|
command: "create",
|
|
async handler() {
|
|
await bootstrap({ cwd: process.cwd() }, async () => {
|
|
const result = await Snapshot.create("test")
|
|
console.log(result)
|
|
})
|
|
},
|
|
})
|
|
|
|
export const SnapshotRestoreCommand = cmd({
|
|
command: "restore <commit>",
|
|
builder: (yargs) =>
|
|
yargs.positional("commit", {
|
|
type: "string",
|
|
description: "commit",
|
|
demandOption: true,
|
|
}),
|
|
async handler(args) {
|
|
await bootstrap({ cwd: process.cwd() }, async () => {
|
|
await Snapshot.restore("test", args.commit)
|
|
console.log("restored")
|
|
})
|
|
},
|
|
})
|