2026-01-07 02:03:06 +01:00
|
|
|
import type { Command } from "commander";
|
|
|
|
|
|
|
|
|
|
import { docsSearchCommand } from "../commands/docs.js";
|
|
|
|
|
import { defaultRuntime } from "../runtime.js";
|
2026-01-10 20:50:17 +01:00
|
|
|
import { formatDocsLink } from "../terminal/links.js";
|
|
|
|
|
import { theme } from "../terminal/theme.js";
|
2026-01-19 00:52:17 +00:00
|
|
|
import { runCommandWithRuntime } from "./cli-utils.js";
|
2026-01-07 02:03:06 +01:00
|
|
|
|
|
|
|
|
export function registerDocsCli(program: Command) {
|
|
|
|
|
program
|
|
|
|
|
.command("docs")
|
2026-01-27 12:19:58 +00:00
|
|
|
.description("Search the live Moltbot docs")
|
2026-01-07 02:03:06 +01:00
|
|
|
.argument("[query...]", "Search query")
|
2026-01-10 20:50:17 +01:00
|
|
|
.addHelpText(
|
|
|
|
|
"after",
|
2026-01-27 11:27:41 +00:00
|
|
|
() => `\n${theme.muted("Docs:")} ${formatDocsLink("/cli/docs", "docs.molt.bot/cli/docs")}\n`,
|
2026-01-10 20:50:17 +01:00
|
|
|
)
|
2026-01-07 02:03:06 +01:00
|
|
|
.action(async (queryParts: string[]) => {
|
2026-01-19 00:52:17 +00:00
|
|
|
await runCommandWithRuntime(defaultRuntime, async () => {
|
2026-01-07 02:03:06 +01:00
|
|
|
await docsSearchCommand(queryParts, defaultRuntime);
|
2026-01-19 00:52:17 +00:00
|
|
|
});
|
2026-01-07 02:03:06 +01:00
|
|
|
});
|
|
|
|
|
}
|