LEARNNode CLI Automation

Log Icons & Symbols for CLI Apps

A great number of developers will use your CLI only if its user experience and user interface both are extraordinary. There are a couple of ways to achieve this. You can add colors to your CLI, add a proper CLI welcome header, etc.

Another way to improve your CLI user experience is to add emojis. Since emoji support in the terminal varies from the operating system to the operating system. If you add emojis in your CLI and the users run your CLI on Windows, they will see a question mark in place of emoji.

There is an npm package that gives you the ability to use cross-platform symbols like success, warning, etc. Let’s take a look at it.

Log Symbols

You can install it in your project by running the following command:

npm install log-symbols

You would then need to require it in your project. This package provides you four cross-platform symbols. These symbols are for info, error, success and warning.

log-symbols package usage is straightforward. If you need a success symbol, you can get one by adding the following piece of code in your project:

const symbol = require('log-symbols');
console.log(symbol.success, ` SUCCESS`);

This code will have an output like this:

Success Icon

You can read its documentation to understand this package further.

Wrapping Up

log-symbols is a nice package that gives you the ability to use informative symbols in your CLIs. You can use this package to present information to your user in a creative way.

Posted by Saad (It's a work in progress: Needs copy editing review by Awais.)