mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-21 18:08:05 -06:00
4c7a8d412b
* feat(cli): support --json across reporting commands * test(cli): satisfy json command checks * test(cli): type json exception map
26 lines
1022 B
TypeScript
26 lines
1022 B
TypeScript
// Commander registration for live OpenClaw docs search.
|
|
import type { Command } from "commander";
|
|
import { formatDocsLink } from "../../packages/terminal-core/src/links.js";
|
|
import { theme } from "../../packages/terminal-core/src/theme.js";
|
|
import { docsSearchCommand } from "../commands/docs.js";
|
|
import { defaultRuntime } from "../runtime.js";
|
|
import { runCommandWithRuntime } from "./cli-utils.js";
|
|
|
|
export function registerDocsCli(program: Command) {
|
|
program
|
|
.command("docs")
|
|
.description("Search the live OpenClaw docs")
|
|
.argument("[query...]", "Search query")
|
|
.option("--json", "Output JSON", false)
|
|
.addHelpText(
|
|
"after",
|
|
() =>
|
|
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/docs", "docs.openclaw.ai/cli/docs")}\n`,
|
|
)
|
|
.action(async (queryParts: string[], opts: { json?: boolean }) => {
|
|
await runCommandWithRuntime(defaultRuntime, async () => {
|
|
await docsSearchCommand(queryParts, defaultRuntime, { json: Boolean(opts.json) });
|
|
});
|
|
});
|
|
}
|