/** * @return the command name */ public String name() { String ret = delegate.name(); return ret; }
/** * @return the command name */ public String name() { String ret = delegate.name(); return ret; }
/** * Returns a single command by its name. * * @param name the command name * @return the commad or null */ default Command getCommand(String name) { return commands().stream().filter(cmd -> cmd.name().equals(name)).findFirst().orElse(null); } }
@Override public void start() throws Exception { Map<String, CommandRegistration> newReg = new HashMap<>(); for (Command command : commands) { String name = command.name(); if (commandMap.containsKey(name)) { throw new Exception("Command " + name + " already registered"); } CommandRegistration registration = new CommandRegistration(command, deploymentID()); newReg.put(name, registration); } commandMap.putAll(newReg); }
public void add(Command command) { commands.put(command.name(), command); }
@Override public void process(CommandProcess process) { InternalCommandManager mgr = process.session().get("vert.x-command-manager"); List<Command> commands = mgr.getResolvers().stream().flatMap(r -> r.commands().stream()).distinct().collect(Collectors.toList()); process.write("available commands:\n"); for (Command command : commands) { process.write(command.name()).write("\n"); } process.end(); } }