Files
openclaw/src/cli/docs-cli.ts
T
Peter Steinberger 4c7a8d412b feat(cli): support --json across reporting commands (#117928)
* feat(cli): support --json across reporting commands

* test(cli): satisfy json command checks

* test(cli): type json exception map
2026-08-02 02:56:08 -07:00

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) });
});
});
}