mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
sync
This commit is contained in:
parent
99c8bf704b
commit
9e7bd9ca9a
1 changed files with 29 additions and 1 deletions
|
|
@ -1,10 +1,12 @@
|
|||
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(CreateCommand).command(RestoreCommand).command(DiffCommand).demandCommand(),
|
||||
builder: (yargs) =>
|
||||
yargs.command(CreateCommand).command(RestoreCommand).command(DiffCommand).command(RevertCommand).demandCommand(),
|
||||
async handler() {},
|
||||
})
|
||||
|
||||
|
|
@ -50,3 +52,29 @@ export const DiffCommand = cmd({
|
|||
})
|
||||
},
|
||||
})
|
||||
|
||||
export const RevertCommand = cmd({
|
||||
command: "revert <sessionID> <messageID>",
|
||||
describe: "revert",
|
||||
builder: (yargs) =>
|
||||
yargs
|
||||
.positional("sessionID", {
|
||||
type: "string",
|
||||
description: "sessionID",
|
||||
demandOption: true,
|
||||
})
|
||||
.positional("messageID", {
|
||||
type: "string",
|
||||
description: "messageID",
|
||||
demandOption: true,
|
||||
}),
|
||||
async handler(args) {
|
||||
await bootstrap({ cwd: process.cwd() }, async () => {
|
||||
const session = await Session.revert({
|
||||
sessionID: args.sessionID,
|
||||
messageID: args.messageID,
|
||||
})
|
||||
console.log(session?.revert)
|
||||
})
|
||||
},
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue