Package org.jline.builtins
Class Completers.DirectoriesCompleter
java.lang.Object
org.jline.builtins.Completers.FileNameCompleter
org.jline.builtins.Completers.DirectoriesCompleter
- All Implemented Interfaces:
org.jline.reader.Completer
- Enclosing class:
Completers
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 Summary
ConstructorsConstructorDescriptionDirectoriesCompleter
(File currentDir) Creates a new DirectoriesCompleter with the specified current directory.DirectoriesCompleter
(Path currentDir) Creates a new DirectoriesCompleter with the specified current directory.DirectoriesCompleter
(Supplier<Path> currentDir) Creates a new DirectoriesCompleter with a supplier for the current directory. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Determines if a path should be accepted for completion.protected Path
Gets the user's current directory.Methods inherited from class org.jline.builtins.Completers.FileNameCompleter
complete, getDisplay, getSeparator, getUserHome
-
Constructor Details
-
DirectoriesCompleter
Creates a new DirectoriesCompleter with the specified current directory.- Parameters:
currentDir
- the current directory as a File
-
DirectoriesCompleter
Creates a new DirectoriesCompleter with the specified current directory.- Parameters:
currentDir
- the current directory as a Path
-
DirectoriesCompleter
Creates a new DirectoriesCompleter with a supplier for the current directory.- Parameters:
currentDir
- a supplier that provides the current directory path
-
-
Method Details
-
getUserDir
Gets the user's current directory.- Overrides:
getUserDir
in classCompleters.FileNameCompleter
- Returns:
- the current directory path
-
accept
Determines if a path should be accepted for completion.Only accepts directories that also pass the parent class's accept method.
- Overrides:
accept
in classCompleters.FileNameCompleter
- Parameters:
path
- the path to check- Returns:
- true if the path should be accepted, false otherwise
-