gunshi / default / PluginContext
Interface: PluginContext<G>
Gunshi plugin context interface.
Since
v0.27.0
Type Parameters
Type Parameter | Default type |
---|---|
G extends GunshiParamsConstraint | DefaultGunshiParams |
Methods
addGlobalOption()
ts
addGlobalOption(name, schema): void;
Add a global option.
Parameters
Parameter | Type | Description |
---|---|---|
name | string | An option name |
schema | ArgSchema | An ArgSchema for the option |
Returns
void
decorateCommand()
ts
decorateCommand<L>(decorator): void;
Decorate the command execution. Decorators are applied in reverse order (last registered is executed first).
Type Parameters
Type Parameter | Default type |
---|---|
L extends Record <string , unknown > | object |
Parameters
Parameter | Type | Description |
---|---|---|
decorator | (baseRunner ) => (ctx ) => Awaitable <string | void > | A decorator function that wraps the command runner |
Returns
void
decorateHeaderRenderer()
ts
decorateHeaderRenderer<L>(decorator): void;
Decorate the header renderer.
Type Parameters
Type Parameter | Default type |
---|---|
L extends Record <string , unknown > | object |
Parameters
Parameter | Type | Description |
---|---|---|
decorator | (baseRenderer , ctx ) => Promise <string > | A decorator function that wraps the base header renderer. |
Returns
void
decorateUsageRenderer()
ts
decorateUsageRenderer<L>(decorator): void;
Decorate the usage renderer.
Type Parameters
Type Parameter | Default type |
---|---|
L extends Record <string , unknown > | object |
Parameters
Parameter | Type | Description |
---|---|---|
decorator | (baseRenderer , ctx ) => Promise <string > | A decorator function that wraps the base usage renderer. |
Returns
void
decorateValidationErrorsRenderer()
ts
decorateValidationErrorsRenderer<L>(decorator): void;
Decorate the validation errors renderer.
Type Parameters
Type Parameter | Default type |
---|---|
L extends Record <string , unknown > | object |
Parameters
Parameter | Type | Description |
---|---|---|
decorator | (baseRenderer , ctx , error ) => Promise <string > | A decorator function that wraps the base validation errors renderer. |
Returns
void
Properties
Property | Modifier | Type | Description |
---|---|---|---|
globalOptions | readonly | Map <string , ArgSchema > | Get the global options |