Examples of StringsCompleter


Examples of co.cask.cdap.shell.completer.StringsCompleter

      .build();
  }

  public Completer getProgramIdCompleter(ElementType elementType) {
    return Objects.firstNonNull(programIdCompleters.get(elementType),
                                new StringsCompleter(ImmutableList.<String>of()));
  }
View Full Code Here

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

Examples of jline.console.completer.StringsCompleter

    }
    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

Examples of jline.console.completer.StringsCompleter

  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

Examples of jline.console.completer.StringsCompleter

            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

Examples of jline.console.completer.StringsCompleter

    }

    @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

Examples of jline.console.completer.StringsCompleter

    }

    @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

Examples of org.apache.felix.karaf.shell.console.completer.StringsCompleter

    public void setFeaturesService(FeaturesService featuresService) {
        this.featuresService = featuresService;
    }

    public int complete(final String buffer, final int cursor, final List candidates) {
        StringsCompleter delegate = new StringsCompleter();
        try {
            for (Repository repository : featuresService.listRepositories()) {
                delegate.getStrings().add(repository.getURI().toString());
            }
        } catch (Exception e) {
            // Ignore
        }
        return delegate.complete(buffer, cursor, candidates);
    }
View Full Code Here

Examples of org.apache.geronimo.gshell.console.completer.StringsCompleter

        this.bundleContext = bundleContext;
    }

    public int complete(final String buffer, final int cursor, final List candidates) {
        Collection<String> artifacts = getComponentsAndAssemblies();
        StringsCompleter delegate = new StringsCompleter(artifacts);
        return delegate.complete(buffer, cursor, candidates);
    }
View Full Code Here

Examples of org.apache.karaf.shell.console.completer.StringsCompleter

public class KarCompleter implements Completer {
   
    private KarService karService;
   
    public int complete(String buffer, int cursor, @SuppressWarnings("rawtypes") List candidates) {
        StringsCompleter delegate = new StringsCompleter();
        try {
            for (String karName : karService.list()) {
                delegate.getStrings().add(karName);
            }
        } catch (Exception e) {
            // ignore
        }
        return delegate.complete(buffer, cursor, candidates);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.