README
Wolff-CLI
An extensible CLI that is providing mini-tools and modules
Installation
First of all you will need node (^8.12.0) and npm. After you installed these (see the Node JS Website). You download Wolff-CLI by typing:
npm install -g wolff-cli
Usage
$ wolff
# by typing this into your terminal it is starting up
# for a little bit more information use 'h' or 'help' at any time when
# it is running
How to add your own tools
- export your module in the standard way:
// require the instance of IOControl created by control-bus.js
const control = require('../control-bus.js');
var parrot = {
name: "name of your tool",
desc: "The description of your tool",
aliases: ["name of your tool", "aliases to", "access your", "tool"],
short: "ara",
commands: {
say: {
name: "\\say",
desc: "An example function"
}
}
}
control.on("startTool:ara", () => {
console.log('an event occurred!: ' + 'starting the parrot Tool');
});
// example on command \say
control.on("cmd:ara:\\say", (answer) => {
// repeat what the user writes after "\say"
// e.g [ara]>\say Don't parrot me!
// @ara_:Don't parrot me
let msg = '@' + control.curCol(parrot.short) + '_:';
msg += (answer) ? answer.slice("\\say ".length) : "nope!";
//write your answer in the console
control.writeRl(msg);
// start the prompt again
control.prompt();
});
// export the description of your module
module.exports = parrot;
- after your script is ready create a folder with the same name as your tool and go to the file lib/tool-modules.js in order to add your modules in alphabetical order
module.exports = {
messenger: require('./messenger/messenger.js'),
parrot: require('./parrot/parrot.js')
};
- at last you install it globally with npm
npm install -g
now everything is ready to use