Skip to content

Configurable option (camel-)casing #2423

@mmkal

Description

@mmkal

Hi! For trpc-cli, I'd like to support properties like useMCPServer: z.string() nicely. Right now, the only way to get commander to parse an option into program.opts().useMCPServer is to define an option --use-m-c-p-server which is horrible looking.

It'd be nice if I could do something like this:

const option = new Option('--use-mcp-server', {attributeName: 'useMCPServer'})

I'm trying a workaround in trpc-cli by sub-classing Option and overriding attributeName(), but it seems a bit brittle: https://github.com/mmkal/trpc-cli/pull/149/files#diff-a2a171449d862fe29692ce031981047d7ab755ae7f84c707aef80701b3ea0c80R287

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions