1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
---
id: helpers
title: Helpers
---
## `runExit` / `run`
```ts
run(opts?: {...}, commands: Command | Command[], argv?: string[], context?: Context)
runExit(opts?: {...}, commands: Command | Command[], argv?: string[], context?: Context)
```
Those functions abstracts the `Cli` class behind simple helpers, decreasing the amount of boilerplate you need to write when building small CLIs.
All parameters except the commands (and the [context](/docs/contexts), if you specify custom keys) are optional and will default to sensible values from the current environment.
Calling `run` will return a promise with the exit code that you'll need to handle yourself, whereas `runExit` will set the process exit code itself.
|