Skip to content

Latest commit

 

History

History
57 lines (36 loc) · 1.89 KB

PreExecutionContext.md

File metadata and controls

57 lines (36 loc) · 1.89 KB

@black-flag/coreDocs


@black-flag/core / util / PreExecutionContext

Type Alias: PreExecutionContext<CustomContext>

PreExecutionContext<CustomContext>: CustomContext & object

Represents the pre-execution context that is the result of calling configureProgram.

Type declaration

execute

execute: Executor

Execute the root command, parsing any available CLI arguments and running the appropriate handler, and return the resulting final parsed arguments object.

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.

Note: when the special GracefulEarlyExitError exception is thrown from within a command's handler or builder, Executor will set context.state.deepestParseResult to NullArguments and context.state.isGracefullyExiting to true. Further, Executor will not re-throw the exception in this special case, returning NullArguments instead.

executionContext

executionContext: CustomContext

A reference to the global context singleton passed to all other configuration hooks, command builders, and command handlers. This object recursively contains some of the same entries as its enclosing PreExecutionContext.

rootPrograms

rootPrograms: Programs

An object containing the effector, helper, and router Program instances belonging to the root command.

Type Parameters

CustomContext extends ExecutionContext = ExecutionContext

Defined in

types/program.ts:291