LEARNNode CLI Automation

Add CLI Welcome Header

Having a nice user experience is extremely important. If you are building a Node.js-based CLI then you need to consider this as well. For instance, your CLI should have a nice, appealing welcome header that has all the necessary information.

Let’s take a look at how we can build one for our Node.js CLI.

cli-welcome

I have written an open-source package that can get you a nice looking welcome header for your Node.js CLI. If you are interested in reading its documentation then click here. You can install it by running the following command inside your terminal.

npm i cli-welcome

Once it’s installed, import it inside your project like this:

const welcome = require(‘cli-welcome’);

You can just pass an object to it containing your CLI title, description, tagline, version, background color, font color etc like this:

welcome({
title: your-cli-title,
tagline: your-cli-tagline,
description: your-cli-description,
version: your-cli-version,
bgColor: your-cli-header-background-color,
color: your-cli-header-font-color
})

Once you run your CLI again, you will see a nice welcome header.

cli welcome npm

Wrapping Up

If your CLI user experience is really good and different from the other CLIs, there is a high chance that the other developers will use it. So it is a really important thing to account for when building an automation developer tool.

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