You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
:speech_balloon: - in case cli arguments are not stored in `process.argv` in your environment, you can pass custom argument source to a second argument of `run()`, however note that first two elements of such source will be ignored as they are expected to store executable and executed file paths instead of args.
293
-
:speech_balloon: - custom help and version output handlers or strings can be passed to a second argument to replace default brocli outputs for those operations with your own.
318
+
Parameters:
319
+
320
+
-`cliName` - name that's used to invoke your application from cli.
321
+
Used for themes that print usage examples, example:
322
+
`app do-task --help` results in `Usage: app do-task <positional> ...`
323
+
Default: `undefined`
324
+
325
+
-`omitKeysOfUndefinedOptions` - flag that determines whether undefined options will be passed to transform\handler or not
326
+
Default: `false`
327
+
328
+
-`argSource` - location of array of args in your environment
329
+
:warning: - first two items of this storage will be ignored as they typically contain executable and executed file paths
330
+
Default: `process.argv`
331
+
332
+
-`version` - string or handler used to print your app version
333
+
:warning: - if passed, takes prevalence over theme's version event
334
+
335
+
-`help` - string or handler used to print your app's global help
336
+
:warning: - if passed, takes prevalence over theme's `globalHelp` event
337
+
338
+
-`theme(event: BroCliEvent)` - function that's used to customize messages that are printed on various events
339
+
Return:
340
+
`true` | `Promise<true>` if you consider event processed
341
+
`false` | `Promise<false>` to redirect event to default theme
342
+
343
+
-`hook(event: EventType, command: Command)` - function that's used to execute code before and after every command's `transform` and `handler` execution
344
+
345
+
### Additional functions
346
+
347
+
-`commandsInfo(commands: Command[])` - get simplified representation of your command collection
348
+
Can be used to generate docs
349
+
350
+
-`test(command: Command, args: string)` - test behaviour for command with specified arguments
351
+
:warning: - if command has `transform`, it will get called, however `handler` won't
352
+
353
+
-`getCommandNameWithParents(command: Command)` - get subcommand's name with parent command names
294
354
295
355
## CLI
296
356
297
-
In `BroCLI`, command doesn't have to be the first argument, instead it may be contained in any order.
298
-
To make this possible, hovewer, option that's stated right before command should have an explicit value, even if it is a flag: `--verbose true <command-name>` (does not apply to reserved flags: [`--help` | `-h` | `--version` | `-v`])
357
+
In `BroCLI`, command doesn't have to be the first argument, instead it may be passed in any order.
358
+
To make this possible, hovewer, option that's passed right before command should have an explicit value, even if it is a flag: `--verbose true <command-name>` (does not apply to reserved flags: [`--help` | `-h` | `--version` | `-v`])
299
359
Options are parsed in strict mode, meaning that having any unrecognized options will result in an error.
0 commit comments