Badges for the terminal

Keff - Aug 22 '20 - - Dev Community

Hey there!

I've just released a little quirky node-js library. Add badges to your cli apps or npm packages.

GitHub logo nombrekeff / cli-badges

Quirky little node-js library for generating badges for your cli apps.

Quirky little node-js library for generating badges for your cli apps.

GitHub file size in bytes npm


Table Of Contents


Getting Started

Installing

As usual, you need to install from npm/yarn:

$ npm install cli-badges

Usage

This is a simple example, using badges to display test results:

const { badge } = require('cli-badges');

const failedBadge  = badge('failed', '2', { theme: 'red' });
const skippedBadge = badge.yellow('skipped', '2');
const successBadge = badge.green('success', '2');

console.log(failedBadge, successBadge, skippedBadge);
Enter fullscreen mode Exit fullscreen mode

The above would output something similar to the terminal:

You could also create a donate badge with a link (if supported):

const donateBadge = badge.blue('❤️ donate',
Enter fullscreen mode Exit fullscreen mode

Usage

This is a simple example, using badges to display test results:

const { badge } = require('cli-badges');

const failedBadge = badge('failed', '2', { 
  messageBg: 'red' 
});
const skippedBadge = badge('skipped', '2', {
  messageBg: 'yellow',
  messageColor: 'white',
});
const successBadge = badge('success', '2', {
  messageBg: 'green',
  messageColor: 'white',
});

console.log(failedBadge, successBadge, skippedBadge);
Enter fullscreen mode Exit fullscreen mode

The above would output something similar to the terminal:

You could also create a donate badge with a link (if supported):

const { badge } = require('cli-badges');

const donateBadge = badge('donate', 'ko-fi', {
  link: 'https://ko-fi.com/logginjs',
});

console.log(donateBadge);
Enter fullscreen mode Exit fullscreen mode

Example output is a mock, console output will vary slightly from terminal to terminal.

cli-badges is now also available for Python, thanks to haideralipunjabi.

GitHub logo haideralipunjabi / cli-badges

Quirky little python package for generating badges for your cli apps.


It would be awesome if you could pass by and give me some feedback. 🥰

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .