Skip to content

CLIPluginHooks ​

Individual lifecycle hooks that a plugin may implement.

Hook order for a successful command run is: beforeParse → afterResolve → beforeAction → middleware/action → afterAction.

Hooks are awaited serially and run in plugin registration order at each stage. Throwing from any hook aborts the command just like throwing from middleware or the action handler. afterAction runs only after the middleware chain and action complete successfully.

Signatures ​

ts
interface CLIPluginHooks {}

Members ​

Properties ​

afterAction ​

Called after the middleware chain and action handler complete successfully.

ts
afterAction?: { (params: ResolvedCommandParams): void | Promise<void>; };

afterResolve ​

Called after parse + resolve, before middleware or action execution.

ts
afterResolve?: { (params: ResolvedCommandParams): void | Promise<void>; };

beforeAction ​

Called immediately before the middleware chain and action handler run.

ts
beforeAction?: { (params: ResolvedCommandParams): void | Promise<void>; };

beforeParse ​

Called immediately before leaf-command argv is parsed.

ts
beforeParse?: { (params: BeforeParseParams): void | Promise<void>; };

See Also ​

Released under the MIT License.