tommy-mitchell / listr-cli

Command-line task lists made pretty.
https://npm.im/listr-cli
MIT License
0 stars 0 forks source link
cli-app command-line-tool listr nodejs npm-package

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 ```sh 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 ```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:

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

Related