Class Completers.DirectoriesCompleter

java.lang.Object
org.jline.builtins.Completers.FileNameCompleter
org.jline.builtins.Completers.DirectoriesCompleter
All Implemented Interfaces:
Completer
Enclosing class:
Completers

public static class Completers.DirectoriesCompleter extends Completers.FileNameCompleter
A completer for directory names.

This completer provides completion for directory paths, filtering out non-directory entries. It extends FileNameCompleter and overrides the accept method to only accept directories.

  • Constructor Details

    • DirectoriesCompleter

      public DirectoriesCompleter(File currentDir)
      Creates a new DirectoriesCompleter with the specified current directory.
      Parameters:
      currentDir - the current directory as a File
    • DirectoriesCompleter

      public DirectoriesCompleter(Path currentDir)
      Creates a new DirectoriesCompleter with the specified current directory.
      Parameters:
      currentDir - the current directory as a Path
    • DirectoriesCompleter

      public DirectoriesCompleter(Supplier<Path> currentDir)
      Creates a new DirectoriesCompleter with a supplier for the current directory.
      Parameters:
      currentDir - a supplier that provides the current directory path
  • Method Details

    • getUserDir

      protected Path getUserDir()
      Gets the user's current directory.
      Overrides:
      getUserDir in class Completers.FileNameCompleter
      Returns:
      the current directory path
    • accept

      protected boolean accept(Path path)
      Determines if a path should be accepted for completion.

      Only accepts directories that also pass the parent class's accept method.

      Overrides:
      accept in class Completers.FileNameCompleter
      Parameters:
      path - the path to check
      Returns:
      true if the path should be accepted, false otherwise