moleculerjs / moleculer-repl

REPL module for Moleculer framework
http://moleculer.services/docs/moleculer-repl.html
MIT License
27 stars 25 forks source link

"Endless" custom command #42

Closed alexeymarunin closed 4 years ago

alexeymarunin commented 4 years ago

Hi

I found a little bug for custom command if it returns non-Promise value

const { ServiceBroker } = require("moleculer");

const broker = new ServiceBroker({
  replCommands: [
    {
      command: "hello [<name>]",
      description: "Say hello",
      alias: "hi",
      types: {
        string: ["name"]
      },
      action(broker, args, helpers) {
        console.log("Hi, " + helpers.kleur.green(args.name || "stranger"));
        return args.name;
      }
    }
  ]
});

broker.repl();

According Vorpal documentation, command's action should call done() in the end or return Promise.

PS May be this bug relates with #22