An library for creating command line interfaces
npm install @zacklukem/cmdjsjs
const {CommandParser, Command, HelpCommand} = require('cmdjs');
`
Create a command parser
`js
const parser = new CommandParser();
`
Add some commands
`js
const myCommand = new Command(['hi', 'hello'], ' - Says Hello!', args => {
console.log("Hello, " + args[0] + "!");
});
parser.addCommand(myCommand);
`
Create a help command:
`js
parser.addCommand(new HelpCommand('This is a hello test!', parser));
`
Then parse some arguments:
`js
parser.parse(['help']);
parser.parse(['hi', "World"]);
`
This should return:
`
This is a hello test!
hi,hello - Says Hello!
Hello, World!
``