Skip to content

tommy-mitchell/listr-cli

Repository files navigation

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 cross-platform.

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

Install

npm install --save-dev listr-cli
Other Package Managers
yarn add --dev listr-cli

Usage

$ npx listr [title::]<command> […]

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
$ listr 'lint::xo --fix' tsd
✔ lint [5s]
✔ tsd [2s]

Options

--hide-timer

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

Example
$ npx listr xo tsd --hide-timer
✔ xo
✔ tsd

--no-persist

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

Example
$ 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
$ 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:

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

Related

  • listr2 - Create beautiful CLI interfaces via easy and logical to implement task lists that feel alive and interactive.