Skip to content

Commit

Permalink
feat: add function input
Browse files Browse the repository at this point in the history
  • Loading branch information
k2on committed Oct 26, 2024
1 parent 00a4245 commit 09ddf77
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions examples/basic/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
import { run, router, command } from "@koons/cli";
import z from "zod";

const cli = router({
add: router({
module: command().fn(() => {
console.log("Adding module");
}),
module: command()
.input(z.object({ name: z.number() }))
.fn(({ name }) => {
console.log(`Name: ${name}`);
}),
package: command()
.input(
z.object({
name: z.string(),
}),
)
.fn(({ name }) => {
console.log(`Package name: ${name}`);
}),
}),
help: command().fn(() => console.log("Help command")),
version: command().fn(() => console.log("Version 1.0")),
Expand Down

0 comments on commit 09ddf77

Please sign in to comment.