mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-25 07:15:19 +00:00
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>
37 lines
932 B
TypeScript
37 lines
932 B
TypeScript
import { File } from "../../../file"
|
|
import { bootstrap } from "../../bootstrap"
|
|
import { cmd } from "../cmd"
|
|
|
|
const FileReadCommand = cmd({
|
|
command: "read <path>",
|
|
builder: (yargs) =>
|
|
yargs.positional("path", {
|
|
type: "string",
|
|
demandOption: true,
|
|
description: "File path to read",
|
|
}),
|
|
async handler(args) {
|
|
await bootstrap({ cwd: process.cwd() }, async () => {
|
|
const content = await File.read(args.path)
|
|
console.log(content)
|
|
})
|
|
},
|
|
})
|
|
|
|
const FileStatusCommand = cmd({
|
|
command: "status",
|
|
builder: (yargs) => yargs,
|
|
async handler() {
|
|
await bootstrap({ cwd: process.cwd() }, async () => {
|
|
const status = await File.status()
|
|
console.log(JSON.stringify(status, null, 2))
|
|
})
|
|
},
|
|
})
|
|
|
|
export const FileCommand = cmd({
|
|
command: "file",
|
|
builder: (yargs) => yargs.command(FileReadCommand).command(FileStatusCommand).demandCommand(),
|
|
async handler() {},
|
|
})
|