diff --git a/src/_parse.ts b/src/_parse.ts index 0b65de3..1a600db 100644 --- a/src/_parse.ts +++ b/src/_parse.ts @@ -1,4 +1,5 @@ import { destr } from "destr"; +import { camelCase } from "scule"; export interface Block { generator: string; @@ -43,7 +44,8 @@ export function parseRawArgs(rawArgs: string) { const args = Object.create(null); for (const part of rawArgs.split(/\s+/)) { - const [key, value] = part.split("="); + const [_key, value] = part.split("="); + const key = _key && camelCase(_key); if (key && value) { args[key] = destr(value); } else if (part.startsWith("no-")) { diff --git a/test/parse.test.ts b/test/parse.test.ts index 958f367..484f63b 100644 --- a/test/parse.test.ts +++ b/test/parse.test.ts @@ -9,7 +9,7 @@ describe("parseRawArgs", () => { [`foo=bar`, { foo: "bar" }], [ `a-key=a-value another-key=another-value`, - { "a-key": "a-value", "another-key": "another-value" }, + { aKey: "a-value", anotherKey: "another-value" }, ], ] as const; for (const [input, expected] of tests) {