|
10 | 10 |
|
11 | 11 | > **runProgram**\<`CustomCliArguments`\>(`commandModulesPath`): [`RunProgramReturnType`](../type-aliases/RunProgramReturnType.md)\<`CustomCliArguments`\> |
12 | 12 |
|
13 | | -Defined in: [src/index.ts:674](https://github.com/Xunnamius/black-flag/blob/7a70c7e44633bf3b15b0662ce212ece66de038c8/src/index.ts#L674) |
| 13 | +Defined in: [src/index.ts:688](https://github.com/Xunnamius/black-flag/blob/d6004b46e3ac5a451e4e0f05bf5c8726ce157ac9/src/index.ts#L688) |
14 | 14 |
|
15 | 15 | Invokes the dynamically imported |
16 | 16 | `configureProgram(commandModulesPath).execute()` function. |
@@ -48,7 +48,7 @@ if any other exception occurs, or `Arguments` otherwise. |
48 | 48 |
|
49 | 49 | > **runProgram**\<`CustomCliArguments`\>(`commandModulesPath`, `configurationHooks`): [`RunProgramReturnType`](../type-aliases/RunProgramReturnType.md)\<`CustomCliArguments`\> |
50 | 50 |
|
51 | | -Defined in: [src/index.ts:694](https://github.com/Xunnamius/black-flag/blob/7a70c7e44633bf3b15b0662ce212ece66de038c8/src/index.ts#L694) |
| 51 | +Defined in: [src/index.ts:708](https://github.com/Xunnamius/black-flag/blob/d6004b46e3ac5a451e4e0f05bf5c8726ce157ac9/src/index.ts#L708) |
52 | 52 |
|
53 | 53 | Invokes the dynamically imported `configureProgram(commandModulesPath, |
54 | 54 | configurationHooks).execute()` function. |
@@ -88,9 +88,51 @@ if any other exception occurs, or `Arguments` otherwise. |
88 | 88 |
|
89 | 89 | ## Call Signature |
90 | 90 |
|
| 91 | +> **runProgram**\<`CustomCliArguments`\>(`commandModulesPath`, `configurationHooks`): [`RunProgramReturnType`](../type-aliases/RunProgramReturnType.md)\<`CustomCliArguments`\> |
| 92 | +
|
| 93 | +Defined in: [src/index.ts:731](https://github.com/Xunnamius/black-flag/blob/d6004b46e3ac5a451e4e0f05bf5c8726ce157ac9/src/index.ts#L731) |
| 94 | + |
| 95 | +Invokes the dynamically imported `configureProgram(commandModulesPath, |
| 96 | +configurationHooks).execute()` function. |
| 97 | + |
| 98 | +This function is suitable for a CLI entry point since it will **never throw |
| 99 | +or reject no matter what.** Instead, when an exception occurs, |
| 100 | +`process.exitCode` is set to the appropriate value, the |
| 101 | +[ConfigureErrorHandlingEpilogue](../type-aliases/ConfigureErrorHandlingEpilogue.md) hook is triggered, and either |
| 102 | +`NullArguments` (only if `GracefulEarlyExitError` was thrown) or `undefined` |
| 103 | +is returned. |
| 104 | + |
| 105 | +Note: It is always safe to invoke this form of `runProgram` as many times as |
| 106 | +desired. |
| 107 | + |
| 108 | +### Type Parameters |
| 109 | + |
| 110 | +#### CustomCliArguments |
| 111 | + |
| 112 | +`CustomCliArguments` *extends* `Record`\<`string`, `unknown`\> = `Record`\<`string`, `unknown`\> |
| 113 | + |
| 114 | +### Parameters |
| 115 | + |
| 116 | +#### commandModulesPath |
| 117 | + |
| 118 | +`string` |
| 119 | + |
| 120 | +#### configurationHooks |
| 121 | + |
| 122 | +`Promisable`\<[`ConfigurationHooks`](../type-aliases/ConfigurationHooks.md)\<`any`\>\> |
| 123 | + |
| 124 | +### Returns |
| 125 | + |
| 126 | +[`RunProgramReturnType`](../type-aliases/RunProgramReturnType.md)\<`CustomCliArguments`\> |
| 127 | + |
| 128 | +`NullArguments` if `GracefulEarlyExitError` is thrown, `undefined` |
| 129 | +if any other exception occurs, or `Arguments` otherwise. |
| 130 | + |
| 131 | +## Call Signature |
| 132 | + |
91 | 133 | > **runProgram**\<`CustomCliArguments`\>(`commandModulesPath`, `preExecutionContext`): [`RunProgramReturnType`](../type-aliases/RunProgramReturnType.md)\<`CustomCliArguments`\> |
92 | 134 |
|
93 | | -Defined in: [src/index.ts:718](https://github.com/Xunnamius/black-flag/blob/7a70c7e44633bf3b15b0662ce212ece66de038c8/src/index.ts#L718) |
| 135 | +Defined in: [src/index.ts:755](https://github.com/Xunnamius/black-flag/blob/d6004b46e3ac5a451e4e0f05bf5c8726ce157ac9/src/index.ts#L755) |
94 | 136 |
|
95 | 137 | Invokes the `preExecutionContext.execute()` function. |
96 | 138 |
|
@@ -133,7 +175,7 @@ if any other exception occurs, or `Arguments` otherwise. |
133 | 175 |
|
134 | 176 | > **runProgram**\<`CustomCliArguments`\>(`commandModulesPath`, `argv`): [`RunProgramReturnType`](../type-aliases/RunProgramReturnType.md)\<`CustomCliArguments`\> |
135 | 177 |
|
136 | | -Defined in: [src/index.ts:742](https://github.com/Xunnamius/black-flag/blob/7a70c7e44633bf3b15b0662ce212ece66de038c8/src/index.ts#L742) |
| 178 | +Defined in: [src/index.ts:779](https://github.com/Xunnamius/black-flag/blob/d6004b46e3ac5a451e4e0f05bf5c8726ce157ac9/src/index.ts#L779) |
137 | 179 |
|
138 | 180 | Invokes the dynamically imported |
139 | 181 | `configureProgram(commandModulesPath).execute(argv)` function. If `argv` is a |
@@ -176,7 +218,7 @@ if any other exception occurs, or `Arguments` otherwise. |
176 | 218 |
|
177 | 219 | > **runProgram**\<`CustomCliArguments`\>(`commandModulesPath`, `argv`, `configurationHooks`): [`RunProgramReturnType`](../type-aliases/RunProgramReturnType.md)\<`CustomCliArguments`\> |
178 | 220 |
|
179 | | -Defined in: [src/index.ts:766](https://github.com/Xunnamius/black-flag/blob/7a70c7e44633bf3b15b0662ce212ece66de038c8/src/index.ts#L766) |
| 221 | +Defined in: [src/index.ts:803](https://github.com/Xunnamius/black-flag/blob/d6004b46e3ac5a451e4e0f05bf5c8726ce157ac9/src/index.ts#L803) |
180 | 222 |
|
181 | 223 | Invokes the dynamically imported `configureProgram(commandModulesPath, |
182 | 224 | configurationHooks).execute(argv)` function. If `argv` is a string, `argv = |
@@ -221,9 +263,56 @@ if any other exception occurs, or `Arguments` otherwise. |
221 | 263 |
|
222 | 264 | ## Call Signature |
223 | 265 |
|
| 266 | +> **runProgram**\<`CustomCliArguments`\>(`commandModulesPath`, `argv`, `configurationHooks`): [`RunProgramReturnType`](../type-aliases/RunProgramReturnType.md)\<`CustomCliArguments`\> |
| 267 | +
|
| 268 | +Defined in: [src/index.ts:828](https://github.com/Xunnamius/black-flag/blob/d6004b46e3ac5a451e4e0f05bf5c8726ce157ac9/src/index.ts#L828) |
| 269 | + |
| 270 | +Invokes the dynamically imported `configureProgram(commandModulesPath, |
| 271 | +configurationHooks).execute(argv)` function. If `argv` is a string, `argv = |
| 272 | +argv.split(' ')` is applied first. |
| 273 | + |
| 274 | +This function is suitable for a CLI entry point since it will **never throw |
| 275 | +or reject no matter what.** Instead, when an exception occurs, |
| 276 | +`process.exitCode` is set to the appropriate value, the |
| 277 | +[ConfigureErrorHandlingEpilogue](../type-aliases/ConfigureErrorHandlingEpilogue.md) hook is triggered, and either |
| 278 | +`NullArguments` (only if `GracefulEarlyExitError` was thrown) or `undefined` |
| 279 | +is returned. |
| 280 | + |
| 281 | +Note: It is always safe to invoke this form of `runProgram` as many times as |
| 282 | +desired. |
| 283 | + |
| 284 | +### Type Parameters |
| 285 | + |
| 286 | +#### CustomCliArguments |
| 287 | + |
| 288 | +`CustomCliArguments` *extends* `Record`\<`string`, `unknown`\> = `Record`\<`string`, `unknown`\> |
| 289 | + |
| 290 | +### Parameters |
| 291 | + |
| 292 | +#### commandModulesPath |
| 293 | + |
| 294 | +`string` |
| 295 | + |
| 296 | +#### argv |
| 297 | + |
| 298 | +`string` | `string`[] |
| 299 | + |
| 300 | +#### configurationHooks |
| 301 | + |
| 302 | +`Promisable`\<[`ConfigurationHooks`](../type-aliases/ConfigurationHooks.md)\<`any`\>\> |
| 303 | + |
| 304 | +### Returns |
| 305 | + |
| 306 | +[`RunProgramReturnType`](../type-aliases/RunProgramReturnType.md)\<`CustomCliArguments`\> |
| 307 | + |
| 308 | +`NullArguments` if `GracefulEarlyExitError` is thrown, `undefined` |
| 309 | +if any other exception occurs, or `Arguments` otherwise. |
| 310 | + |
| 311 | +## Call Signature |
| 312 | + |
224 | 313 | > **runProgram**\<`CustomCliArguments`\>(`commandModulesPath`, `argv`, `preExecutionContext`): [`RunProgramReturnType`](../type-aliases/RunProgramReturnType.md)\<`CustomCliArguments`\> |
225 | 314 |
|
226 | | -Defined in: [src/index.ts:792](https://github.com/Xunnamius/black-flag/blob/7a70c7e44633bf3b15b0662ce212ece66de038c8/src/index.ts#L792) |
| 315 | +Defined in: [src/index.ts:854](https://github.com/Xunnamius/black-flag/blob/d6004b46e3ac5a451e4e0f05bf5c8726ce157ac9/src/index.ts#L854) |
227 | 316 |
|
228 | 317 | Invokes the `preExecutionContext.execute(argv)` function. If `argv` is a |
229 | 318 | string, `argv = argv.split(' ')` is applied first. |
@@ -271,7 +360,7 @@ if any other exception occurs, or `Arguments` otherwise. |
271 | 360 |
|
272 | 361 | > **runProgram**\<`CustomCliArguments`\>(...`args`): [`RunProgramReturnType`](../type-aliases/RunProgramReturnType.md)\<`CustomCliArguments`\> |
273 | 362 |
|
274 | | -Defined in: [src/index.ts:812](https://github.com/Xunnamius/black-flag/blob/7a70c7e44633bf3b15b0662ce212ece66de038c8/src/index.ts#L812) |
| 363 | +Defined in: [src/index.ts:874](https://github.com/Xunnamius/black-flag/blob/d6004b46e3ac5a451e4e0f05bf5c8726ce157ac9/src/index.ts#L874) |
275 | 364 |
|
276 | 365 | Run the given program with the configuration given in `args`. |
277 | 366 |
|
|
0 commit comments