@@ -12,6 +12,10 @@ function createCompletionProgram(): Command {
|
12 | 12 | program.name("openclaw"); |
13 | 13 | program.description("CLI root"); |
14 | 14 | program.option("-v, --verbose", "Verbose output"); |
| 15 | +program.option( |
| 16 | +"--status-json", |
| 17 | +"Output JSON (alias for `models status --json`) in $OPENCLAW_STATE_DIR", |
| 18 | +); |
15 | 19 | |
16 | 20 | const gateway = program.command("gateway").description("Gateway commands"); |
17 | 21 | gateway.option("--force", "Force the action"); |
@@ -38,6 +42,21 @@ describe("completion-cli", () => {
|
38 | 42 | expect(script).toContain("(status) _openclaw_gateway_status ;;"); |
39 | 43 | expect(script).toContain("(restart) _openclaw_gateway_restart ;;"); |
40 | 44 | expect(script).toContain("--force[Force the action]"); |
| 45 | +expect(script).toContain("\\`models status --json\\`"); |
| 46 | +expect(script).toContain("\\$OPENCLAW_STATE_DIR"); |
| 47 | +}); |
| 48 | + |
| 49 | +it("escapes zsh option descriptions for double-quoted arguments specs", () => { |
| 50 | +const program = new Command() |
| 51 | +.name("openclaw") |
| 52 | +.option("--literal", "Use $OPENCLAW_STATE_DIR with `model/list` and John's profile"); |
| 53 | + |
| 54 | +const script = getCompletionScript("zsh", program); |
| 55 | + |
| 56 | +expect(script).toContain( |
| 57 | +"--literal[Use \\$OPENCLAW_STATE_DIR with \\`model/list\\` and John's profile]", |
| 58 | +); |
| 59 | +expect(script).not.toContain("John'\\''s"); |
41 | 60 | }); |
42 | 61 | |
43 | 62 | it("defers zsh registration until compinit is available", async () => { |
|