All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.cli.completers.HelpCompleter Maven / Gradle / Ivy

package org.infinispan.cli.completers;

import java.util.ArrayList;
import java.util.List;

import org.aesh.command.completer.CompleterInvocation;
import org.aesh.command.completer.OptionCompleter;
import org.aesh.command.invocation.CommandInvocation;
import org.aesh.command.registry.CommandRegistry;

public class HelpCompleter implements OptionCompleter {
   @Override
   public void complete(CompleterInvocation invocation) {
      List completeValues = new ArrayList<>();
      CommandRegistry registry = ((ContextAwareCompleterInvocation) invocation).context.getRegistry();
      if (registry != null) {
         for (String command : registry.getAllCommandNames()) {
            if (command.startsWith(invocation.getGivenCompleteValue()))
               completeValues.add(command);
         }
         invocation.setCompleterValues(completeValues);
      }
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy