console-program
v1.0.3
Published
Create simple cmd programs on node js
Downloads
6
Readme
ConsoleProgramm is a lightweight library for making console programs in Node.js.
Installation
You can install YourLibrary via npm:
npm install console-program
Usage:
const ConsoleProgram = require("console-program");
const tools = {
yourCommand1: {
func: yourCallback1,
description: "Your description1",
},
yourCommand2: {
func: yourCallback2,
description: "Your description2",
},
};
function yourCallback1(pathArg) {
// in this example pathArg is the argument that user passes like:
// node app.js --yourCallback1="path"
//
// do smth...
}
function yourCallback2(args) {
// in this example arg is the arguments devided by spaces like:
// node app.js --yourCallback2="arg1 arg2"
//
const [arg1, arg2] = args.split(" ");
// do smth...
}
const yourProgramInstance = new ConsoleProgram(tools);
yourProgramInstance.execute();