Add commands in a simple way in the artisan mode.

The artyom.on method is an alternative to the artyom.addCommands, with the only purpose of add some sugar syntax to the way that you add commands. It comes in handy for projects where artyom is used for a couple of commands.

It's not a Promise implementation, it's just a wrapper that adds the command internally using artyom.addCommands. As first parameter you need to provide the indexes property of a command and it will return an object with the then property that is a function. Invoke the function and provide a function as first argument, it receives the index (index of item in the array that matches with the command) and wildcard (if smart).

Normal command

let artyom = new Artyom();

artyom.on(['Good morning','Good afternoon']).then(function(i){
    switch (i) {
        case 0:
            artyom.say("Good morning, how are you?");
        case 1:
            artyom.say("Good afternoon, how are you?");

Smart command

If you want to create a smart command, provide the second parameter of the on function as true:

artyom.on(['Repeat after me *'] , true).then(function(i,wildcard){
    artyom.say("You've said : " + wildcard);