Skip to content

Commit

Permalink
move disclaimer
Browse files Browse the repository at this point in the history
  • Loading branch information
mmkal committed May 28, 2024
1 parent 8318cdc commit c4581f9
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Turn a [tRPC](https://trpc.io) router into a type-safe, fully-functional, docume
<!-- codegen:start {preset: markdownTOC, maxDepth: 3} -->
- [Installation](#installation)
- [Usage](#usage)
- [Disclaimer](#disclaimer)
- [Parameters and flags](#parameters-and-flags)
- [Default command](#default-command)
- [API docs](#api-docs)
Expand Down Expand Up @@ -55,9 +56,13 @@ cli.run()

And that's it! Your tRPC router is now a CLI program with help text and input validation. You can run it with `node path/to/script.js add --left 2 --right 3`.

### Disclaimer

>Note that this library is still v0, so parts of the API may change slightly. The basic usage of `trpcCli({router}).run()` will remain though, and any breaking changes will be published via release notes!
### Parameters and flags

CLI positional parameters and flags are derived from each procedure's input type. Inputs should use a `zod` object or tuple type for the procedure to be mapped to a CLI command.
CLI positional parameters and flags are derived from each procedure's input type. Inputs use `zod` types for the procedure to be mapped to a CLI command.

#### Positional parameters

Expand All @@ -71,7 +76,7 @@ t.router({
})
```

You can also use anything that accepts string, number, or boolean inputs, like `z.enum(['up', 'down'])`, `z.literal(123)`, `z.string().regex(/^\w+$/)` etc.
You can also use anything that accepts string, number, or boolean inputs, like `z.enum(['up', 'down'])`, `z.number().int()`, `z.literal(123)`, `z.string().regex(/^\w+$/)` etc.

Multiple positional parameters can use a `z.tuple(...)` input type:

Expand Down Expand Up @@ -159,8 +164,6 @@ Procedures with incompatible inputs will be returned in the `ignoredProcedures`

>You can also pass an existing tRPC router that's primarily designed to be deployed as a server to it, in order to invoke your procedures directly, in development.
>Note that this library is still v0, so parts of the API may change slightly. The basic usage of `trpcCli({router}).run()` will remain though!
### Default command

You can define a default command for your CLI - set this to the procedure that should be invoked directly when calling your CLI. Useful for simple CLIs that only do one thing, or when you want to make the most common command very quick to type (e.g. `yarn` being an alias for `yarn install`):
Expand Down

0 comments on commit c4581f9

Please sign in to comment.