Class CandidateListCompletionHandler

java.lang.Object
jline.console.completer.CandidateListCompletionHandler
All Implemented Interfaces:
CompletionHandler

public class CandidateListCompletionHandler extends Object implements CompletionHandler
A CompletionHandler that deals with multiple distinct completions by outputting the complete list of possibilities to the console. This mimics the behavior of the readline library.
Since:
2.3
  • Field Details

    • printSpaceAfterFullCompletion

      private boolean printSpaceAfterFullCompletion
    • stripAnsi

      private boolean stripAnsi
  • Constructor Details

    • CandidateListCompletionHandler

      public CandidateListCompletionHandler()
  • Method Details

    • getPrintSpaceAfterFullCompletion

      public boolean getPrintSpaceAfterFullCompletion()
    • setPrintSpaceAfterFullCompletion

      public void setPrintSpaceAfterFullCompletion(boolean printSpaceAfterFullCompletion)
    • isStripAnsi

      public boolean isStripAnsi()
    • setStripAnsi

      public void setStripAnsi(boolean stripAnsi)
    • complete

      public boolean complete(ConsoleReader reader, List<CharSequence> candidates, int pos) throws IOException
      Specified by:
      complete in interface CompletionHandler
      Throws:
      IOException
    • setBuffer

      public static void setBuffer(ConsoleReader reader, CharSequence value, int offset) throws IOException
      Throws:
      IOException
    • printCandidates

      public static void printCandidates(ConsoleReader reader, Collection<CharSequence> candidates) throws IOException
      Print out the candidates. If the size of the candidates is greater than the ConsoleReader.getAutoprintThreshold(), they prompt with a warning.
      Parameters:
      candidates - the list of candidates to print
      Throws:
      IOException
    • getUnambiguousCompletions

      private String getUnambiguousCompletions(List<CharSequence> candidates)
      Returns a root that matches all the String elements of the specified List, or null if there are no commonalities. For example, if the list contains foobar, foobaz, foobuz, the method will return foob.
    • startsWith

      private static boolean startsWith(String starts, String[] candidates)
      Returns:
      true is all the elements of candidates start with starts