npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

cli-pen

v0.1.12-2

Published

Elegant CLI helper for NodeJS terminal apps.

Downloads

14

Readme

cli-pen Build Status Coverage Status

Elegant CLI helper for NodeJS terminal apps.

Note: APIs may change in near future releases. The APIs are expected to get stable after the first major release (v1.0.0). You can help improve the APIs / API format by raising an issue.

Install

npm install --save cli-pen

Currently, the tools provided by cli-pen include:

  • Pen
  • ProgressBar
  • Spinner

Pen

A pen is a simple console utility to replace your console.log usage in the NodeJS terminal apps.

Pen example GIF

Usage

const { Pen } = require('cli-pen');
const pen = Pen();
pen.info('Console some information.');
pen.warn('Some warning', {
  format: ':symbol :message',
});

API

Pen([options])

options are optional. If not provided, default values are used.

options

Type: object

format

Type: string Default: :symbol :title :message\n

color

Type: object | string Default: gray

Note: If a string is used, all types error info success warning (for :message) use the same color.

You can provide an object for custom color configuration like:

{
  error: 'red',
  info: 'white',
  success: 'green',
  warning: 'yellow'
}
titleColor

Type: object | string Default: error: red info: blue success: green warning: yellow

Note: If a string is used, all types error info success warning (for :title) use the same color.

You can provide custom colors for titles in a similar way as for color.

title

Type: object | string

Default: error: error info: info success: success warning: warning

Note: If a string is used, all types error info success warning (for :title) use the same text.

stream

Type: WriteableStream Default: process.stderr

Stream to write on terminal.

Options: process.stdout

Instance

  • .error(message [, options]) Write an error message to console.

  • .info(message [, options]) Write an info message to console.

  • .success(message [, options]) Write a success message to console.

  • .warning(message [, options]) Write a warning message to console.

  • .log(message) An alternative to native console.log. Use it in a similar fashion.

message

Type: string | Array<string>

options

Type: object

A typical options parameter example would be like:

{
  format: ':symbol :message\n',
  color: 'blue',
}

ProgressBar

A simple ProgressBar for terminal apps.

ProgressBar example GIF

Usage

const { ProgressBar } = require('cli-pen');
const progress = ProgressBar(30);
progress.tick(10);
setTimeout(() => {
  progress.tick(20);
  console.log('task completed.');
}, 1500);

API

ProgressBar(total)

total is the number of ticks to complete.

Instance

.tick([progress])

A single call on tick increments the progress by 1. If an optional progress is passed, the progress is increments by that number.

Spinner

A simple Spinner for terminal apps.

Spinner example GIF

Usage

const { Spinner } = require('cli-pen');
const spinner = Spinner({
  color: 'blue',
});
spinner.start();

API

Spinner([options|text])

If a string is provided, it would work as options.text.

options

Type: object

text

Type: string

Text to display after the spinner.

format

Type: string Default: :spinner :text

spinner

Type: string object Default: line

You can look for list of available spinners here.

color

Type: string Default: white Values: black red green yellow blue magenta cyan white gray

Color of the spinner.

stream

Type: WriteableStream Default: process.stderr

Stream to write on terminal.

Options: process.stdout

Instance

.start()

Starts the spinner.

.stop()

Stops the spinner.

.info(message)

Stops the spinner with an information message.

.succeed(message)

Stops the spinner with a success message.

.warn(message)

Stops the spinner with a warning message.

.fail(message)

Stops the spinner with a failure message.

.text

Change the text of the spinner

.color

Change the color of the spinner

Inspiration

CLI-PEN is inspired by some amazing cli tools as ora, progress and few others.

CLI-PEN aims to be a fully featured cli tool for terminal apps built on NodeJS.

License

MIT © Yatharth Khatri