mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-16 00:40:43 +00:00
fix(cli): exit 0 when invoking parent commands without a subcommand (#73077)
Several `openclaw <parent>` commands (channels, plugins, approvals, devices, cron, mcp) were exiting with code 1 when invoked bare, while printing the same help-style content that `<parent> --help` produces (which exits 0). This broke `&&` chains and surfaced a misleading `ELIFECYCLE Command failed with exit code 1.` line under pnpm. Add a small `applyParentDefaultHelpAction(cmd)` helper in `src/cli/program/parent-default-help.ts` that attaches a default action which prints the parent's own help and sets `process.exitCode = 0`. The helper is a no-op when the parent already has its own action (e.g. `agents` defaulting to `agents list`), so existing intentional defaults are preserved. Apply it to the six core parents listed in #73077.
This commit is contained in:
committed by
Peter Steinberger
parent
482c74b724
commit
ba80695bba
@@ -23,6 +23,7 @@ import { isRich, theme } from "../terminal/theme.js";
|
||||
import { callGatewayFromCli } from "./gateway-rpc.js";
|
||||
import { nodesCallOpts, resolveNodeId } from "./nodes-cli/rpc.js";
|
||||
import type { NodesRpcOpts } from "./nodes-cli/types.js";
|
||||
import { applyParentDefaultHelpAction } from "./program/parent-default-help.js";
|
||||
|
||||
type ExecApprovalsSnapshot = {
|
||||
path: string;
|
||||
@@ -616,4 +617,6 @@ export function registerExecApprovalsCli(program: Command) {
|
||||
return true;
|
||||
},
|
||||
});
|
||||
|
||||
applyParentDefaultHelpAction(approvals);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user