Skip to content

Commit 5543a13

Browse files
CLI: escape zsh completion descriptions
1 parent 3847048 commit 5543a13

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎src/cli/completion-cli.test.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,19 @@ describe("completion-cli", () => {
4646
expect(script).toContain("\\$OPENCLAW_STATE_DIR");
4747
});
4848

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");
60+
});
61+
4962
it("defers zsh registration until compinit is available", async () => {
5063
if (process.platform === "win32") {
5164
return;

0 commit comments

Comments
 (0)