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.
npm install --save-dev listr-cli
Other Package Managers
yarn add --dev listr-cli
$ npx listr [title::]<command> […]
Commands should be space-separated. Commands with spaces in them must be surrounded by quotes.
Equivalent to command1 && command2 && …
.
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]
Disable showing successful task durations. By default, durations are shown.
Example
$ npx listr xo tsd --hide-timer
✔ xo
✔ tsd
Disable persisting task output. By default, task outputs persist after completion.
Example
$ npx listr xo ava --no-persist
✔ xo [2s]
⠼ ava
› ✔ cli › main
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]
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"
- listr2 - Create beautiful CLI interfaces via easy and logical to implement task lists that feel alive and interactive.