Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 479 Bytes

File metadata and controls

33 lines (23 loc) · 479 Bytes

Use Node to write a command line tool Back

First step is to add bin attributes in package.json

In the following case, this comand line is named cls

{
    "bin": {
        "cls": "lib/start.js"
    }
}

Then create a script start.js for this

#! /usr/bin/env/node

console.log('cls command');

Run npm link to install script on the OS

sudo npm link

Uninstall

sudo npm rm --global cls