drizzle-team / drizzle-team/brocli

feature request: auto transform option names

Open
#5 0 comments 2 reactions 1 assignee Claimed by @Sukairo-02 View on GitHub
Dominant language
TypeScript
Stars
477
Forks
6
PR merge metrics
No merged PRs in 30d

Description

currently if i use camel-cased arguments in `options`, brocli would keep it as-is:

```ts
const foo = command({
name: 'foo',
options: {
fooBar: string()
},
handler: console.log
})
```

would result in something along
```sh
$ node test.js foo -h

Usage:
foo [flags]

Flags:
--fooBar string

$ node test.js foo --foo-bar 123
Unrecognized options for command 'foo': --foo-bar
```

and while that's mostly personal preference, i think that camel-cased arguments are ugly and prefer them being in `kebab-case`. and currently the only way to achieve that is manually putting kebab-cased version everywhere (either as a key or a display name)

i propose some way for library users to achieve that more cleanly, probably by exposing some kind of delegate in the `run()` config, something like

```ts
run([...], {
transformName: {
fromCli: kebabToCamel,
toCli: camelToKebab
}
})
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.