import type { Command } from "commander"; import { resolveCommitHash } from "../../infra/git-commit.js"; import { formatDocsLink } from "../../terminal/links.js"; import { isRich, theme } from "../../terminal/theme.js"; import { escapeRegExp } from "../../utils.js"; import { hasFlag, hasRootVersionAlias } from "../argv.js"; import { formatCliBannerLine, hasEmittedCliBanner } from "../banner.js"; import { replaceCliName, resolveCliName } from "../cli-name.js"; import { CLI_LOG_LEVEL_VALUES, parseCliLogLevelOption } from "../log-level-option.js"; import type { ProgramContext } from "./context.js"; import { getCoreCliCommandsWithSubcommands } from "./core-command-descriptors.js"; import { getSubCliCommandsWithSubcommands } from "./subcli-descriptors.js";
const CLI_NAME = resolveCliName(); const CLI_NAME_PATTERN = escapeRegExp(CLI_NAME); const ROOT_COMMANDS_WITH_SUBCOMMANDS = new Set([
...getCoreCliCommandsWithSubcommands(),
...getSubCliCommandsWithSubcommands(),
]); const ROOT_COMMANDS_HINT = "Hint: commands suffixed with * have subcommands. Run <command> --help for details.";
const EXAMPLES = [
["openclaw models --help", "Show detailed help for the models command."],
[ "openclaw channels login --verbose", "Link personal WhatsApp Web and show QR + connection logs.",
],
[ 'openclaw message send --target +15555550123 --message "Hi" --json', "Send via your web session and print JSON result.",
],
["openclaw gateway --port 18789", "Run the WebSocket Gateway locally."],
["openclaw --dev gateway", "Run a dev Gateway (isolated state/config) on ws://127.0.0.1:19001."],
["openclaw gateway --force", "Kill anything bound to the default gateway port, then start it."],
["openclaw gateway ...", "Gateway control via WebSocket."],
[ 'openclaw agent --to +15555550123 --message "Run summary" --deliver', "Talk directly to the agent using the Gateway; optionally send the WhatsApp reply.",
],
[ 'openclaw message send --channel telegram --target @mychat --message "Hi"', "Send via your Telegram bot.",
],
] as const;
export function configureProgramHelp(program: Command, ctx: ProgramContext) {
program
.name(CLI_NAME)
.description("")
.version(ctx.programVersion)
.option( "--container <name>", "Run the CLI inside a running Podman/Docker container named <name> (default: env OPENCLAW_CONTAINER)",
)
.option( "--dev", "Dev profile: isolate state under ~/.openclaw-dev, default gateway port 19001, and shift derived ports (browser/canvas)",
)
.option( "--profile <name>", "Use a named profile (isolates OPENCLAW_STATE_DIR/OPENCLAW_CONFIG_PATH under ~/.openclaw-<name>)",
)
.option( "--log-level <level>",
`Global log level override for file + console (${CLI_LOG_LEVEL_VALUES})`,
parseCliLogLevelOption,
);
program.option("--no-color", "Disable ANSI colors", false);
program.helpOption("-h, --help", "Display help for command");
program.helpCommand("help [command]", "Display help for command");
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.