Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tommy-mitchell/listr-cli

Command-line task lists made pretty.
https://github.com/tommy-mitchell/listr-cli

cli-app command-line-tool listr nodejs npm-package

Last synced: 8 days ago
JSON representation

Command-line task lists made pretty.

Awesome Lists containing this project

README

        

# listr-cli

Command-line task lists made pretty.

Gracefully handles and displays failures, including if a given command is not found. Supports local binaries from `node_modules/.bin` without specifying `npx`, and allows [setting environment variables](#environment---env--e) cross-platform.

If used in a CI environment, command output is outputted as is.

## Install

```sh
npm install --save-dev listr-cli
```

Other Package Managers

```sh
yarn add --dev listr-cli
```

## Usage

```sh
$ npx listr [title::] […]
```

Commands should be space-separated. Commands with spaces in them must be surrounded by quotes.

Equivalent to `command1 && command2 && …`.

### Named Tasks

Tasks can be prefixed with a custom name, in the form `title::command`. Multi-word titles must be surrounded by quotes. By default, task titles use the first word of a command.

Example

```sh
$ listr 'lint::xo --fix' tsd
✔ lint [5s]
✔ tsd [2s]
```

### Options

#### `--hide-timer`

Disable showing successful task durations. By default, durations are shown.

Example

```sh
$ npx listr xo tsd --hide-timer
✔ xo
✔ tsd
```

#### `--no-persist`

Disable persisting task output. By default, task outputs persist after completion.

Example

```sh
$ npx listr xo ava --no-persist
✔ xo [2s]
⠼ ava
› ✔ cli › main
```

#### `--all-optional` (`--opt`)

Continue executing tasks if one fails. By default, the task list will cancel early.

Example

```sh
$ listr xo 'ava --tap | node parse.js' tsd --all-optional
✔ xo [2s]
✖ ava
› Passed: 10, Failed: 2
✔ tsd [2s]
```

#### `--environment` (`--env`, `-e`)

Set environment variables cross-platform via `process.env`. Follows the same syntax as [Rollup](https://rollupjs.org/command-line-interface/#environment-values):

```sh
$ listr ava --env CI,NODE_OPTIONS:'--loader=tsx'
#=> process.env.CI = "true"
#=> process.env.NODE_OPTIONS = "--loader=tsx"
```

## Related

- [listr2](https://github.com/cenk1cenk2/listr2) - Create beautiful CLI interfaces via easy and logical to implement task lists that feel alive and interactive.