Skip to content

parse

Generated reference page for the parse function export.

Signatures

ts
function parse(schema: CommandSchema, argv: readonly string[]): ParseResult;
ParameterTypeDescription
schemaCommandSchemaThe command schema to parse against
argvreadonly string[]Raw argv strings (NOT including the command name itself)

Members

Members

parse

Parse tokenized argv against a command schema.

Low-level API: most apps should let cli() or runCommand() handle parsing automatically. Call parse() directly when you need raw parsed values before env/config/default resolution or when writing custom tooling around schemas.

ts
(schema: CommandSchema, argv: readonly string[]): ParseResult;

Examples

ts
const parsed = parse(deploy.schema, ['production', '--force']);
// => { args: { target: 'production' }, flags: { force: true } }

See Also

Released under the MIT License.