Module: command
Classes
Type Aliases
CommandConfig
Ƭ CommandConfig<RunArgs
>: Object
Type parameters
Name | Type |
---|---|
RunArgs | extends ArgsObject = ArgsObject |
Type declaration
Name | Type | Description |
---|---|---|
name | string | Command name |
description | string | Command description, displayed in the help output |
run | Runner <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? | string | The prefix to match before option aliases, e.g. - |
optionPrefix? | string | The prefix to match before option names, e.g. -- |
Defined in
ArgsObject
Ƭ ArgsObject: Record
<string
| number
| symbol
, any
>
An object with string keys and any values.
Defined in
Runner
Ƭ Runner<Args
>: (options
: Args
, instance
: MassargCommand
<Args
>) => Promise
<void
> | void
Type parameters
Name | Type |
---|---|
Args | extends ArgsObject |
Type declaration
▸ (options
, instance
): Promise
<void
> | void
Parameters
Name | Type |
---|---|
options | Args |
instance | MassargCommand <Args > |
Returns
Promise
<void
> | void
Defined in
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
Name | Type |
---|---|
RunArgs | extends ArgsObject = ArgsObject |
Parameters
Name | Type |
---|---|
args | ZodType <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
}>