node package manager
Easy collaboration. Discover, share, and reuse code in your team. Create a free org »


Clifier Build Status

Create cli utility for node.js easily, including:

  • Full command/argument parser
  • Consistant inputs and arguments
  • Auto help generator
  • Progress and table generators

Getting Started

Install the module with: npm install clifier

var cli = require('clifier');
    .description('Hello command !');
    .command('testcommand', 'description')
    .input('name', '[a-z]+')
    .argument('-a1, --arg1', 'foo', 'defaultValue', function(value){
        return "filtered value: " + value;
    .argument('-a2, --arg2', 'bar')
    .action((name, arg1, arg2) => {
        cli.success('Hello '+name);
        cli.warning("What is that?");
        cli.table(['header', 1, 2], [['Content', 1, 2]]);
        var progress = cli.progress("Installing something", 100),
            i        = 0,
            interval = function () {
                if (== 100) {
                } else {
                    setTimeout(interval, 10);



return a Cli instance.


.version(string) : Cli

Set the version of your cli utility

.name(string) : Cli

Set the name of your cli utility

.description(string) : Cli

Set the description of your cli utility


Write something on the stdout

.style(content, style)

Transform content with asked style. Need to be send to write.


Write a success text on the stdout


Write a warning text on the stdout


Write an error text on the stderr


Write a log text on the stdout if verbose enabled

.command(name, description) : Command

Create a new command with name and description.

Command API

.input(name, validator) : Command

Add an input to the command.

  • name (string) : name of the input
  • validator (string) : RegExp to validate the input

.argument(name, description, defaultValue, filter) : Command

Add an argument to the command.

  • name (string) : name of the argument (--arg, -arg)
  • description (string) : description of the argument
  • defaultValue (mixed) : default value of the argument if empty
  • filter (function) : filter function for the argument

.action(function(...inputs, ...arguments)) : Command

Action of the command when executed. Function will receive all inputs and arguments in define orders as parameters.


See LICENSE file