org.jline.builtins.Completers Java Examples

The following examples show how to use org.jline.builtins.Completers. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: sqlline   Author: julianhyde   File:    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
SqlLineCommandCompleter(SqlLine sqlLine) {
  super(new LinkedList<>());
  List<Completer> completers = new LinkedList<>();

  for (CommandHandler commandHandler : sqlLine.getCommandHandlers()) {
    for (String cmd : commandHandler.getNames()) {
      List<Completer> compl = new LinkedList<>();
      final List<Completer> parameterCompleters =
      if (parameterCompleters.size() == 1
          && parameterCompleters.iterator().next()
              instanceof Completers.RegexCompleter) {
      } else {
        final String commandName = SqlLine.COMMAND_PREFIX + cmd;
        final String helpText = commandHandler.getHelpText();
        final int firstEndOfLineIndex = helpText.indexOf('\n');
            new StringsCompleter(
                new SqlLineCandidate(sqlLine,
                    AttributedString.stripAnsi(commandName), commandName,
                    firstEndOfLineIndex == -1
                        ? helpText
                        : helpText.substring(0, firstEndOfLineIndex),
                    // there could be whatever else instead helpText
                    // which is the same for commands with all theirs aliases
                    null, helpText, true)));
        compl.add(new NullCompleter()); // last param no complete
        completers.add(new ArgumentCompleter(compl));

Example #2
Source Project: sshd-shell-spring-boot   Author: anand1st   File:    License: Apache License 2.0 4 votes vote down vote up
TerminalProcessor terminalProcessor() {
    return new TerminalProcessor(properties.getShell(), new Completers.TreeCompleter(buildTextCompleters()),