loading...
Cover image for Badges for the terminal

Badges for the terminal

nombrekeff profile image Manolo Edge Updated on ・1 min read

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


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', {
  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);

The above would output something similar to the terminal:

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

const donateBadge = badge('❤️ donate', 'ko-fi'

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);

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);

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. 🥰

Posted on by:

nombrekeff profile

Manolo Edge

@nombrekeff

I don't know... I just code and they pay me!

Discussion

pic
Editor guide
 
 

Thanks man! Just a fun little thingy 😊

 

This is super cool, I'm going to use it in Express Autodocs

 

That would be great! 🥰

 

Cool. It's those nifty little fun things we all love, isn't it?

 

Yup, not as useful as shields.io, but could have some fun usecases. I'm using it for an experimental testing framework I'm building.

 

cli-badges is also available for python now, ported by haideralipunjabi.

github.com/haideralipunjabi/cli-ba...