Skip to content

Latest commit

 

History

History
42 lines (24 loc) · 1.69 KB

configureProgram.md

File metadata and controls

42 lines (24 loc) · 1.69 KB

@black-flag/coreDocs


@black-flag/core / index / configureProgram

Function: configureProgram()

configureProgram<CustomContext>(commandModulePath, configurationHooks?): Promise<PreExecutionContext>

Create and return a PreExecutionContext containing fully-configured Program instances and an Executor entry point function.

Command auto-discovery will occur at commandModulePath. An exception will occur if no commands are loadable from the given commandModulePath.

This function throws whenever an exception occurs, making it not ideal as an entry point for a CLI. See runProgram for a wrapper function that handles exceptions and sets the exit code for you.

Type Parameters

CustomContext extends ExecutionContext = ExecutionContext

Parameters

commandModulePath: string

Command auto-discovery will occur at commandModulePath. An exception will occur if no commands are loadable from the given commandModulePath.

'file://...'-style URLs are also accepted.

configurationHooks?: Promisable<ConfigurationHooks>

Returns

Promise<PreExecutionContext>

Defined in

src/index.ts:59