Skip to main content

Module: command

Classes

Type Aliases

CommandConfig

Ƭ CommandConfig<RunArgs>: Object

Type parameters

NameType
RunArgsextends ArgsObject = ArgsObject

Type declaration

NameTypeDescription
namestringCommand name
descriptionstringCommand description, displayed in the help output
runRunner<RunArgs>Function used when invoking this command. It receives the parsed options and the primary instance of Massarg used to invoke this command (the top-level instance)
aliases?string[]Command aliases
aliasPrefix?stringThe prefix to match before option aliases, e.g. -
optionPrefix?stringThe prefix to match before option names, e.g. --

Defined in

src/command.ts:18

src/command.ts:40


ArgsObject

Ƭ ArgsObject: Record<string | number | symbol, any>

An object with string keys and any values.

Defined in

src/command.ts:47


Runner

Ƭ Runner<Args>: (options: Args, instance: MassargCommand<Args>) => Promise<void> | void

Type parameters

NameType
Argsextends ArgsObject

Type declaration

▸ (options, instance): Promise<void> | void

Parameters
NameType
optionsArgs
instanceMassargCommand<Args>
Returns

Promise<void> | void

Defined in

src/command.ts:49

Functions

CommandConfig

CommandConfig<RunArgs>(args): ZodObject<{ name: ZodString ; description: ZodString ; aliases: ZodOptional<ZodArray<ZodString, "many">> ; run: ZodType<Runner<RunArgs>, ZodTypeDef, Runner<RunArgs>> ; optionPrefix: ZodOptional<ZodDefault<ZodString>> ; aliasPrefix: ZodOptional<ZodDefault<ZodString>> }, "strip", ZodTypeAny, { name: string ; description: string ; run: Runner<RunArgs> ; aliases?: string[] ; aliasPrefix?: string ; optionPrefix?: string }, { name: string ; description: string ; run: Runner<RunArgs> ; aliases?: string[] ; aliasPrefix?: string ; optionPrefix?: string }>

Type parameters

NameType
RunArgsextends ArgsObject = ArgsObject

Parameters

NameType
argsZodType<RunArgs, ZodTypeDef, RunArgs>

Returns

ZodObject<{ name: ZodString ; description: ZodString ; aliases: ZodOptional<ZodArray<ZodString, "many">> ; run: ZodType<Runner<RunArgs>, ZodTypeDef, Runner<RunArgs>> ; optionPrefix: ZodOptional<ZodDefault<ZodString>> ; aliasPrefix: ZodOptional<ZodDefault<ZodString>> }, "strip", ZodTypeAny, { name: string ; description: string ; run: Runner<RunArgs> ; aliases?: string[] ; aliasPrefix?: string ; optionPrefix?: string }, { name: string ; description: string ; run: Runner<RunArgs> ; aliases?: string[] ; aliasPrefix?: string ; optionPrefix?: string }>

Defined in

src/command.ts:18