New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@dinoabsoluto/flex-progress

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dinoabsoluto/flex-progress

Progress indicator for Node.js

latest
Source
npmnpm
Version
2.4.0
Version published
Maintainers
1
Created
Source

flex-progress

CLI progress bar made simple

Build Status Coverage Status npm version

An object-oriented approach to progress bar.

  • Simple: no template, no ticking, just change the ratio property and you're good to go.
  • Theme: personalize with colors and style.
  • Object-oriented: each element is an object, updating its data leads to updating the output. No need to care about what other elements are doing.
const FlexProgress = require('@dinoabsoluto/flex-progress')
// ESModules or Typescript
// import * as FlexProgress from '@dinoabsoluto/flex-progress'

const out = new FlexProgress.Output()
const bar = new FlexProgress.Bar({ width: 25 })

out.append(
  1, new FlexProgress.Spinner(),
  1, 'Hello World!',
  1, new FlexProgress.Spinner(),
  1, '⸨', bar, '⸩'
)

let count = 0
const loop = setInterval(() => {
  count++
  bar.ratio = (count % 39) / 38
}, 80)

NOTE: The images above are screen captures of the demos in folder examples.

Concept: Why is it flex-progress?

This was inspired by CSS Flexbox concept, although much simpler.

Basically, all elements have flexShrink and flexGrow properties, which controls how much they shrink/grow. (flex is a shorthand for both)

In most case, you'll want your progress Bar to have fixed width and a Text with flexShrink set to 1. This way, your text will fill up the CLI width, but will truncate at the end of the line.

Usage

See documents for more details.

For a simple explanation see this example.

Keywords

cli

FAQs

Package last updated on 03 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts