2025-07-01 16:06:38 +00:00
|
|
|
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 () => {
|
2025-07-02 00:06:11 +00:00
|
|
|
const content = await File.read(args.path)
|
2025-07-01 16:06:38 +00:00
|
|
|
console.log(content)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
})
|
2025-07-02 00:39:43 +00:00
|
|
|
|
|
|
|
|
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))
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
2025-08-27 20:27:49 +00:00
|
|
|
const FileListCommand = cmd({
|
|
|
|
|
command: "list <path>",
|
|
|
|
|
builder: (yargs) =>
|
|
|
|
|
yargs.positional("path", {
|
|
|
|
|
type: "string",
|
|
|
|
|
demandOption: true,
|
|
|
|
|
description: "File path to list",
|
|
|
|
|
}),
|
|
|
|
|
async handler(args) {
|
|
|
|
|
await bootstrap({ cwd: process.cwd() }, async () => {
|
|
|
|
|
const files = await File.list(args.path)
|
|
|
|
|
console.log(JSON.stringify(files, null, 2))
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
2025-07-02 00:39:43 +00:00
|
|
|
export const FileCommand = cmd({
|
|
|
|
|
command: "file",
|
2025-08-27 20:27:49 +00:00
|
|
|
builder: (yargs) =>
|
|
|
|
|
yargs.command(FileReadCommand).command(FileStatusCommand).command(FileListCommand).demandCommand(),
|
2025-07-02 00:39:43 +00:00
|
|
|
async handler() {},
|
|
|
|
|
})
|