Merge pull request #28 from rawwerks/fix/camelcase-option-names

fix(generate-cli): use camelCase for Commander.js option names
This commit is contained in:
Peter Steinberger 2025-12-29 20:25:09 +01:00 committed by GitHub
commit cd36e8fe61
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -434,7 +434,9 @@ export function renderToolCommand(
});
const buildArgs = tool.options
.map((option) => {
const source = `cmdOpts.${option.property}`;
// Commander.js converts kebab-case flags to camelCase property names
const camelCaseProp = option.cliName.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
const source = `cmdOpts.${camelCaseProp}`;
return `if (${source} !== undefined) args.${option.property} = ${source};`;
})
.join('\n\t\t');