Skip to content

Latest commit

 

History

History
58 lines (37 loc) · 1.93 KB

getInvocableExtendedHandler.md

File metadata and controls

58 lines (37 loc) · 1.93 KB

@black-flag/extensions


@black-flag/extensions / index / getInvocableExtendedHandler

Function: getInvocableExtendedHandler()

getInvocableExtendedHandler<CustomCliArguments, CustomExecutionContext>(maybeCommand, context): Promise<(argv_) => Promise<void>>

Defined in: packages/extensions/src/index.ts:1400

This function returns a version of maybeCommand's handler function that is ready to invoke immediately. It can be used with both BFE and normal Black Flag command exports.

It returns a handler that expects to be passed a "reified argv," i.e. the object given to the command handler after all checks have passed and all updates to argv have been applied (including subOptionOf and BFE's implies).

For this reason, invoking the returned handler will not run any BF or BFE builder configurations on the given argv object. Whatever you pass the returned handler will be re-gifted to the command's handler as-is and without correctness checks.

Use CustomCliArguments (and CustomExecutionContext) to assert the expected shape of the "reified argv".

See the BFE documentation for more details.

Type Parameters

CustomCliArguments extends Record<string, unknown>

CustomExecutionContext extends ExecutionContext

Parameters

Maybecommand

Promisable<ImportedConfigurationModule<CustomCliArguments, CustomExecutionContext> | ImportedConfigurationModule<CustomCliArguments, AsStrictExecutionContext<CustomExecutionContext>>>

Context

CustomExecutionContext

Returns

Promise<(argv_) => Promise<void>>