Package jline.console.completer

Examples of jline.console.completer.StringsCompleter


      List<String> options = new ArrayList<String>();
      for (OptionHelp optionHelp : command.getOptionsHelp()) {
        options.addAll(optionHelp.getOptions());
      }
      AggregateCompleter arguementCompleters = new AggregateCompleter(
          new StringsCompleter(options), new FileNameCompleter());
      ArgumentCompleter argumentCompleter = new ArgumentCompleter(
          argumentDelimiter, arguementCompleters);
      argumentCompleter.setStrict(false);
      this.commandCompleters.put(command.getName(), argumentCompleter);
    }
View Full Code Here


    }
    Set<String> commands = new HashSet<String>();
    for(Map.Entry<String,Command> c : environment.commands.entrySet()) {
      commands.add(c.getKey());
    }
    reader.addCompleter(new StringsCompleter(commands));
    this.environment = environment;
  }
View Full Code Here

  public CommandCompleter(Map<String, Command<StratosCommandContext>> commands) {
    if (logger.isDebugEnabled()) {
      logger.debug("Creating auto complete for {} commands", commands.size());
    }
    argumentMap = new HashMap<String, Collection<String>>();
    defaultCommandCompleter = new StringsCompleter(commands.keySet());
    helpCommandCompleter = new ArgumentCompleter(new StringsCompleter(CliConstants.HELP_ACTION),
        defaultCommandCompleter);
    for (String action : commands.keySet()) {
      Command<StratosCommandContext> command = commands.get(action);
      Options commandOptions = command.getOptions();
      if (commandOptions != null) {
View Full Code Here

            if (logger.isTraceEnabled()) {
              logger.trace("Removing argument {}", token);
            }
            args.remove(token);
          }
          completers.add(new StringsCompleter(token));
        }
        completers.add(new StringsCompleter(args));
        Completer completer = new ArgumentCompleter(completers);
        return completer.complete(buffer, cursor, candidates);
      } else if (CliConstants.HELP_ACTION.equals(action)) {
        // For help action, we need to display available commands as arguments
        return helpCommandCompleter.complete(buffer, cursor, candidates);
View Full Code Here

    }

    @SuppressWarnings({"unchecked", "rawtypes"})
    public int complete(String buffer, int cursor, List candidates) {
        try {
            StringsCompleter delegate = new StringsCompleter();
            List<CamelContext> camelContexts = camelController.getCamelContexts();
            for (CamelContext camelContext : camelContexts) {
                delegate.getStrings().add(camelContext.getName());
            }
            return delegate.complete(buffer, cursor, candidates);
        } catch (Exception e) {
            // nothing to do, no completion
        }
        return 0;
    }
View Full Code Here

    }

    @SuppressWarnings({"unchecked", "rawtypes"})
    public int complete(String buffer, int cursor, List candidates) {
        try {
            StringsCompleter delegate = new StringsCompleter();
            List<Route> routes = camelController.getRoutes(null);
            for (Route route : routes) {
                delegate.getStrings().add(route.getId());
            }
            return delegate.complete(buffer, cursor, candidates);
        } catch (Exception e) {
            // nothing to do, no completion
        }
        return 0;
    }
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    public int complete(String buffer, int cursor, List candidates) {
        try {
            StringsCompleter delegate = new StringsCompleter();
            List<CamelContext> camelContexts = camelController.getCamelContexts();
            for (CamelContext camelContext : camelContexts) {
                delegate.getStrings().add(camelContext.getName());
            }
            return delegate.complete(buffer, cursor, candidates);
        } catch (Exception e) {
            // nothing to do, no completion
        }
        return 0;
    }
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    public int complete(String buffer, int cursor, List candidates) {
        try {
            StringsCompleter delegate = new StringsCompleter();
            List<Route> routes = camelController.getRoutes(null);
            for (Route route : routes) {
                delegate.getStrings().add(route.getId());
            }
            return delegate.complete(buffer, cursor, candidates);
        } catch (Exception e) {
            // nothing to do, no completion
        }
        return 0;
    }
View Full Code Here

        try {
            final ConsoleReader console = new ConsoleReader(
                    NAME,
                    new FileInputStream(FileDescriptor.in), System.out, null);

            console.addCompleter(new StringsCompleter("open", "close", "send", "ping", "exit", "quit", "help"));
            console.setPrompt(getPrompt());

            if (args.length > 0) {

                int i = 0;
View Full Code Here

public class CamelContextCompleter extends CamelCompleterSupport {

    @SuppressWarnings({"unchecked", "rawtypes"})
    public int complete(String buffer, int cursor, List candidates) {
        try {
            StringsCompleter delegate = new StringsCompleter();
            List<CamelContext> camelContexts = camelController.getCamelContexts();
            for (CamelContext camelContext : camelContexts) {
                delegate.getStrings().add(camelContext.getName());
            }
            return delegate.complete(buffer, cursor, candidates);
        } catch (Exception e) {
            // nothing to do, no completion
        }
        return 0;
    }
View Full Code Here

TOP

Related Classes of jline.console.completer.StringsCompleter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.