Skip to content

Prompts#76

Merged
mmkal merged 34 commits intomainfrom
prompts2
May 2, 2025
Merged

Prompts#76
mmkal merged 34 commits intomainfrom
prompts2

Conversation

@mmkal
Copy link
Copy Markdown
Owner

@mmkal mmkal commented May 1, 2025

Closes #12

You can now enable prompts for positional arguments and options simply by installing @inquirer/prompts or enquirer:

npm install @inquirer/prompts

The pass it in when running your CLI:

import * as prompts from '@inquirer/prompts' // or import * as prompts from 'enquirer'
import {createCli} from 'trpc-cli'

const cli = createCli({router: myRouter})

cli.run({prompts})

The user will then be asked to input any missing arguments or options. Booleans, numbers, enums etc. will get appropriate user-friendly prompts, along with input validation.

prompts-demo

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 1, 2025

Open in StackBlitz

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

commit: 83122be

@mmkal mmkal marked this pull request as ready for review May 2, 2025 15:09
mmkal added 5 commits May 2, 2025 14:52
there was a bug: when there was a required param on subcommands, it wasn't (always?) being passed down properly

so now instead of copying the config we tell the parent to pass through arguments and options, and set the `.action` to just pass the args straight down to the child
@mmkal mmkal merged commit 450a879 into main May 2, 2025
5 checks passed
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.

Feature request: repl mode

1 participant