File: helpers.md

package info (click to toggle)
node-clipanion 3.2.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,232 kB
  • sloc: javascript: 75; makefile: 2
file content (17 lines) | stat: -rw-r--r-- 718 bytes parent folder | download | duplicates (2)
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.