File tree Expand file tree Collapse file tree 4 files changed +18
-2
lines changed
Expand file tree Collapse file tree 4 files changed +18
-2
lines changed Original file line number Diff line number Diff line change 1+ - [ 2025-04-23] [ Support arg typing via command helper] ( https://github.com/RubricLab/cli/commit/01730221c250dc651a1cc466ff3aef85a4361a1e )
12- [ 2025-04-23] [ Trigger build] ( https://github.com/RubricLab/cli/commit/f48dfb50b8388ca5b9a6762aba521093a8226e5b )
23- [ 2025-04-14] [ src -> lib] ( https://github.com/RubricLab/cli/commit/5366d58c027c275252ef7e79f20afd61183949c6 )
34- [ 2025-04-14] [ publish lib/index] ( https://github.com/RubricLab/cli/commit/77d2c126ff9cf6ec9bcbff925d79bcda2b187da6 )
Original file line number Diff line number Diff line change 11import { parseCommand } from './parse'
22import type { CLI , Command } from './types'
33export { format } from './colors'
4+ import type { z } from 'zod'
45export type { Command , CLI }
56
67export function createCLI ( config : {
@@ -21,3 +22,17 @@ export function createCLI(config: {
2122 }
2223 }
2324}
25+
26+ export function createCommand < T extends z . ZodSchema > ( config : {
27+ name : string
28+ description : string
29+ args : T
30+ handler : ( args : z . infer < T > ) => void | Promise < void >
31+ } ) : Command {
32+ return {
33+ name : config . name ,
34+ description : config . description ,
35+ args : config . args ,
36+ handler : config . handler
37+ }
38+ }
Original file line number Diff line number Diff line change 11import type { z } from 'zod'
22
3- export type Command < TArgs extends z . ZodType = z . AnyZodObject > = {
3+ export type Command < TArgs extends z . ZodSchema = z . ZodSchema > = {
44 name : string
55 description : string
66 args : TArgs
Original file line number Diff line number Diff line change 88 "lint:fix" : " bun x biome lint . --write --unsafe"
99 },
1010 "name" : " @rubriclab/cli" ,
11- "version" : " 0.0.5 " ,
11+ "version" : " 0.0.6 " ,
1212 "main" : " lib/index.ts" ,
1313 "private" : false ,
1414 "dependencies" : {
You can’t perform that action at this time.
0 commit comments