8000 negate all booleans by mmkal · Pull Request #102 · mmkal/trpc-cli · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

negate all booleans #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 10, 2025
Merged

negate all booleans #102

merged 1 commit into from
Jun 10, 2025

Conversation

mmkal
Copy link
Owner
@mmkal mmkal commented Jun 10, 2025

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
Copy link
Owner Author
mmkal commented Jun 10, 2025

@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

@mmkal Thanks! Works great 👍

@mmkal mmkal merged commit 9d8b687 into main Jun 10, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4DB2
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0