Type utilities
Types inferred from a CLI or subcommand definition. All of them take typeof yourCommand.
import type { InferInputType, InferOutputType } from "@staticbolt/args-parser";
const subcommand = defineSubcommand({/* ... */});
type Input = InferInputType<typeof subcommand>;type Output = InferOutputType<typeof subcommand>;Input types
What you pass to execute and executeAsync. Values are the schema's input type, before validation.
| Type | Gives you |
|---|---|
InferInputType | { options, arguments, positionals } |
InferOptionsInputType | Just the options record |
InferArgumentsInputType | Just the arguments record |
Output types
What a handler receives. Values are the schema's output type, after validation and defaults.
| Type | Gives you |
|---|---|
InferOutputType | { subcommand, options, arguments, positionals, context } |
InferOptionsOutputType | Just the options record |
InferArgumentsOutputType | Just the arguments record |
Fields that do not exist on the definition come out as undefined. A command with no arguments has no argument type to worry about.
export function runFromCode(options: InferOptionsInputType<typeof listyCLI>) { listyCLI.execute({ options });}