Skip to content

negate all booleans - #102

Merged
mmkal merged 1 commit into
mainfrom
negate-all-booleans
Jun 10, 2025
Merged

mmkal merged 1 commit into
mainfrom
negate-all-booleans

Conversation

@mmkal

@mmkal mmkal commented Jun 10, 2025 •

Copy link
Copy Markdown
Owner

this enables two nice things:

"scripts": {
"abc": "mycli --foo"
}

pnpm abc // {foo: true}
pnpm abc --no-foo // {foo: false}

now, if you do foo: z.boolean().optional() as an option:

mycli --foo // {foo: true}
mycli --no-foo // {foo: false}
mycli // {} (no foo property at all)

and your cli can add custom behaviour when options.foo === undefined e.g. prompting for the user to decide if they want foo or not, definitively

cc @AmanVarshney01

this enables two nice things:

1)
"scripts": {
  "abc": "mycli --foo"
}

pnpm abc // foo: true
pnpm abc --no-foo // foo: false

2)
now, if you do `foo: z.boolean().optional()` as an option:

mycli --foo // {foo: true}
mycli --no-foo // {foo: false}
mycli // {} (no foo property at all)

and your cli can add custom behaviour when options.foo === undefined e.g. prompting for the user to decide proactively
@mmkal

mmkal commented Jun 10, 2025

Copy link
Copy Markdown
Owner Author

@AmanVarshney01 pkg-pr-new ran too early to comment on the PR but you can try this with:

npm i https://pkg.pr.new/mmkal/trpc-cli@9796d8d

@AmanVarshney01

Copy link
Copy Markdown

@mmkal Thanks! Works great 👍

@mmkal
mmkal merged commit 9d8b687 into main Jun 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants