mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-14 21:50:44 +00:00
fix(cli): keep status usage on fast path
This commit is contained in:
@@ -14,6 +14,8 @@ import {
|
||||
resolveCliNetworkProxyPolicy,
|
||||
} from "./command-path-policy.js";
|
||||
|
||||
const ROOT_HELP_ALIASES = new Set(["tools"]);
|
||||
|
||||
export function rewriteUpdateFlagArgv(argv: string[]): string[] {
|
||||
const index = argv.indexOf("--update");
|
||||
if (index === -1) {
|
||||
@@ -41,6 +43,9 @@ export function shouldUseRootHelpFastPath(
|
||||
return (
|
||||
env.OPENCLAW_DISABLE_CLI_STARTUP_HELP_FAST_PATH !== "1" &&
|
||||
(invocation.isRootHelpInvocation ||
|
||||
(invocation.commandPath.length === 1 &&
|
||||
ROOT_HELP_ALIASES.has(invocation.commandPath[0] ?? "") &&
|
||||
invocation.hasHelpOrVersion) ||
|
||||
(invocation.commandPath.length === 1 &&
|
||||
invocation.commandPath[0] === "help" &&
|
||||
invocation.hasHelpOrVersion))
|
||||
|
||||
@@ -156,6 +156,7 @@ describe("shouldUseRootHelpFastPath", () => {
|
||||
expect(shouldUseRootHelpFastPath(["node", "openclaw", "--help"])).toBe(true);
|
||||
expect(shouldUseRootHelpFastPath(["node", "openclaw", "--profile", "work", "-h"])).toBe(true);
|
||||
expect(shouldUseRootHelpFastPath(["node", "openclaw", "help", "--help"])).toBe(true);
|
||||
expect(shouldUseRootHelpFastPath(["node", "openclaw", "tools", "--help"])).toBe(true);
|
||||
expect(shouldUseRootHelpFastPath(["node", "openclaw", "status", "--help"])).toBe(false);
|
||||
expect(shouldUseRootHelpFastPath(["node", "openclaw", "--help", "status"])).toBe(false);
|
||||
expect(shouldUseRootHelpFastPath(["node", "openclaw", "help", "gateway"])).toBe(false);
|
||||
|
||||
Reference in New Issue
Block a user