mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-28 08:32:12 +00:00
Summary:
- This PR updates CLI root option parsing to preserve embedded equals signs, adds focused Vitest coverage for inline and space-separated values, and records the fix in the changelog.
- Reproducibility: yes. by source inspection: current main uses `raw.split("=", 2)`, so `--token=abc=def` returns only `abc`; the PR body also supplies after-fix live output for the same path.
Automerge notes:
- PR branch already contained follow-up commit before automerge: fix(cli): preserve equals in root option values [AI-assisted]
Validation:
- ClawSweeper review passed for head 8a15801e79.
- Required merge gates passed before the squash merge.
Prepared head SHA: 8a15801e79
Review: https://github.com/openclaw/openclaw/pull/84107#issuecomment-4487314163
Co-authored-by: Thiago Costa <thiago12_fera@hotmail.com>
Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com>
Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com>
Approved-by: takhoffman
Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
30 lines
890 B
TypeScript
30 lines
890 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { takeCliRootOptionValue } from "./root-option-value.js";
|
|
|
|
describe("takeCliRootOptionValue", () => {
|
|
it("preserves equals signs after the first separator", () => {
|
|
expect(takeCliRootOptionValue("--token=abc=def", undefined)).toEqual({
|
|
value: "abc=def",
|
|
consumedNext: false,
|
|
});
|
|
expect(takeCliRootOptionValue("--token=abc==", undefined)).toEqual({
|
|
value: "abc==",
|
|
consumedNext: false,
|
|
});
|
|
});
|
|
|
|
it("treats empty inline values as missing", () => {
|
|
expect(takeCliRootOptionValue("--token=", "fallback")).toEqual({
|
|
value: null,
|
|
consumedNext: false,
|
|
});
|
|
});
|
|
|
|
it("continues to consume the next token for space-separated values", () => {
|
|
expect(takeCliRootOptionValue("--token", "abc=def")).toEqual({
|
|
value: "abc=def",
|
|
consumedNext: true,
|
|
});
|
|
});
|
|
});
|