Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

cli-progress-footer

medikoo3.8mISC2.3.3

[![Build status][build-image]][build-url] [![Tests coverage][cov-image]][cov-url] [![npm version][npm-image]][npm-url]

readme

Build status Tests coverage npm version

cli-progress-footer

Manage dynamic progress content below std output stream

Content agnostic. For reliable output all of process std output needs go through this utility. To ensure that by default process.stdout.write is overriden and process.stderr is redirected into process.stdout (with possibility to opt out from both).

Installation

npm install cli-progress-footer

Usage

const cliProgressFooter = require("cli-progress-footer")();

// Write progress
cliProgresssFooter.updateProgress("# processing 1\n# processing 2\n# processing 3\n");
...
// Update progress content when necessary
cliProgresssFooter.updateProgress("# processing 2\n# processing 3\n# processing 4\n");
...
// Update progress content when necessary
cliProgresssFooter.updateProgress("# processing 3\n# processing 4\n");

By default both stdout and stderr output is automatically handled and ensured to appear above progress content

Options

overrideStdout bool (default: true)

Whether to override data written to process.stdout stream so it appears in all cases above progress bar. Modified writes are passed immediately to native process.stdout.write so there's no risk of losing some log content or seing it out of sync

You may opt out but then if any content is written to process.stdout, process output may appear as not reliable.

When opting out you may write regular log content via cliProgressFooter.writeStdout(data)

redirectStderr bool (default: true)

When progress footer is in play, all output should be treated as one std stream. If it's not the case then any stderr output may break visible log output. Therefore by default all stderr content is redirected to stdout.

If you wish to redirect stderr somewhere else with cli means, then it's best turn this function off (so proces.stderr.write is not overriden)

discardStdin bool (default: true)

Whether to mute stdin input (so it doesn't add to displayed progress output). In scope of that setting also cursor is hidden

workaroundChildProcess bool (default: true)

Whether to hide a progress bar for a time being of child process runs with inherited stdio.

Problem is that output of such processes cannot be controlled, and if happens will break the progress bar output.

Internal workaround is to decorate child_process module functions, and react accordingly whenever problematic child process is created

Throbber animation

Additionally each progress line may be automatically prefixed with throbber (frames customizable at cliProgresssFooter.progressAnimationPrefixFrames), for that apply following setting:

cliProgressFooter.shouldAddProgressAnimationPrefix = true;

Tests

npm test

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

2.3.3 (2024-02-29)

Bug Fixes

  • Ensure \r chars do not break progress output (888af14)

Maintenance Improvements

  • Exclude updateProgress method (48bc757)

2.3.2 (2022-05-30)

Bug Fixes

  • Improve recognition of inherited child processes (ef76603)

2.3.1 (2022-03-31)

Maintenance Improvements

  • Ensure to rely on latest version of cli-color (4ff2b87)

2.3.0 (2021-12-09)

Features

  • Workaround child processes with inherited stdio (101f46c)

Bug Fixes

  • Fix handling of input at writeStdout when progress in not active (0b8bf3d)

2.2.0 (2021-11-24)

Features

  • discardStdin option (true by default) (6082161)

2.1.1 (2021-09-22)

Bug Fixes

  • Fix handling of doubled empty line (9b3b7e3)

2.1.0 (2021-09-22)

Features

  • Do not introduce line gap if previous feed line is already empty (6c0ccca)

Bug Fixes

  • Ensure correct lines length calculation (cf5b94e)
  • Fix resolution of gap (11fb97e)

2.0.2 (2021-09-14)

Bug Fixes

  • Ensure proper handling of feed data that doesn't end with new line (07678a3)
  • Fix internal string length calculation for rich unicode chars (c41afab)
  • Fix last feed line handling when terminal wrapping occurs (20e1941)

2.0.1 (2021-09-10)

Bug Fixes

  • Fix output updates in case of output wrapping (1abb356)
  • Apply std stream overrides only when displaying progress (d7023b1)

Maintenance Improvements

  • Seclude _repaint method (bd99cb0)

2.0.0 (2021-09-06)

⚠ BREAKING CHANGES

  • Node.js version 10 or later is required

Features

  • Support for multiline progress rows (cd25917)

Maintenance Improvements

  • Drop support for Node.js versions below v10 (022bc5a)
  • Upgrade ansi-regex to v5 (3ccc4ee)
  • Upgrade cli-color to v2 (50162aa)
  • Upgrade process-utils to v4 (09e81c0)

1.1.1 (2019-02-21)

Bug Fixes

  • scroll to last progress line not bottom (f77abaa)

1.1.0 (2018-11-15)

Bug Fixes

  • default with windows supported chars on windows (0490f8e)

Features

  • support progress interval customization (7ac4d5e)

1.0.0 (2018-10-23)

Bug Fixes

  • variable progress lines count handling (cebaedd)

Features

  • ensure blank line between ongoing and progresss content (b128311)
  • ensure new line at end of progress content (995addb)
  • Optionally automate animated row prefix (3649b9a)
  • support array as updateProgress input (1009760)