Example #1
0
 var repl = function(system) {
   vorpal.delimiter('?'.green +' fuge>'.bold).show();
   commands.forEach(function (com) {
     //creates a vorpal instance for each object in commands
     if (com.command === 'start' || com.command === 'watch'||
     com.command === 'unwatch' || com.command === 'grep'||
     com.command === 'stop'  || com.command === 'info' || 
     com.command === 'tail' || com.command === 'untail'){
       inputStructure(com.command,'[process]',
         com.description, com.action, system);
     }
     else if (com.command === 'debug') {
       inputStructure(com.command,'<process>',
         com.description, com.action, system);
     }
     else if (com.command === 'send') {
       inputStructure(com.command,'<process> <message>',
         com.description, com.action, system);
     }
     else {
       inputStructure(com.command,null, com.description,
         com.action, system);
     }
   });
 };
Example #2
0
  var repl = function (system) {
    vorpal.delimiter('?'.green + ' fuge>'.bold).show()

    var exit = vorpal.find('exit') // override built in exit command
    if (exit) {
      exit.remove()
    }

    autoComp(system) // add all process to autocomplete

    // creates a vorpal instance for each object in commands
    commands.forEach(function (com) {
      if (com.command === 'watch' || com.command === 'unwatch' ||
        com.command === 'info' || com.command === 'tail' || com.command === 'untail') {
        inputStructure(com.command, '[process]', com.description, com.action, system)
      } else if (com.command === 'debug') {
        inputStructure(com.command, '<process>', com.description, com.action, system)
      } else if (com.command === 'start' || com.command === 'stop' || com.command === 'exit' || com.command === 'grep') {
        inputStructure(com.command, '[process...]', com.description, com.action, system)
      } else if (com.command === 'profile') {
        inputStructure(com.command, '<process>', com.description, com.action, system)
      } else if (com.command === 'send') {
        inputStructure(com.command, '<process> <message>', com.description, com.action, system)
      } else {
        inputStructure(com.command, null, com.description, com.action, system)
      }
    })
  }
Example #3
0
  activate() {
    if (process.versions.electron) {
      // Vorpal crashes electron
      return
    }
    if (this.active) {
      this.instance.show()
      return
    }

    this.active = true
    this.instance.delimiter(CLI_DELIMITER)
    this.instance.show()
    this.instance.log(WELCOME_MESSAGE)
  }
discoveryServer.start(function(err) {

    if (err) {
        console.log("Error , cannot start LDS ", err.message);
        console.log("Make sure that a LocalDiscoveryServer is not already running");
        return;

    }
    console.log("discovery server started on port ",discoveryServer.endpoints[0].port);
    console.log("CTRL+C to stop");


    const vorpal = new Vorpal();
    vorpal
        .command("info")
        .description("display list of registered servers.")
        .action(function(args, callback) {

            this.log(discoveryServer.serverInfo);
            // xx this.log(discoveryServer.endpoints[0]);

            {
                const servers = Object.keys(discoveryServer.registeredServers);
                this.log("number of registered servers : ", servers.length);

                for (const serverKey of servers) {
                    const server = discoveryServer.registeredServers[serverKey];
                    this.log("key =", serverKey);
                    this.log(server.toString());
                }
            }
            {
                const server2 = Object.keys(discoveryServer.mDnsResponder.registeredServers);
                this.log("number of mNDS registered servers : ", server2.length);
                for (const serverKey of server2) {
                    const server = discoveryServer.mDnsResponder.registeredServers[serverKey];
                    this.log("key =", serverKey);
                    this.log(server.toString());
                }
            }

            callback();
        });
        vorpal.delimiter("local-discovery-server$").use(vorpal_repl).show();

});