Package org.jline.builtins
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 Summary
Constructors Constructor Description DirectoriesCompleter(java.io.File currentDir)
Creates a new DirectoriesCompleter with the specified current directory.DirectoriesCompleter(java.nio.file.Path currentDir)
Creates a new DirectoriesCompleter with the specified current directory.DirectoriesCompleter(java.util.function.Supplier<java.nio.file.Path> currentDir)
Creates a new DirectoriesCompleter with a supplier for the current directory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
accept(java.nio.file.Path path)
Determines if a path should be accepted for completion.protected java.nio.file.Path
getUserDir()
Gets the user's current directory.-
Methods inherited from class org.jline.builtins.Completers.FileNameCompleter
complete, getDisplay, getSeparator, getUserHome
-
-
-
-
Constructor Detail
-
DirectoriesCompleter
public DirectoriesCompleter(java.io.File currentDir)
Creates a new DirectoriesCompleter with the specified current directory.- Parameters:
currentDir
- the current directory as a File
-
DirectoriesCompleter
public DirectoriesCompleter(java.nio.file.Path currentDir)
Creates a new DirectoriesCompleter with the specified current directory.- Parameters:
currentDir
- the current directory as a Path
-
DirectoriesCompleter
public DirectoriesCompleter(java.util.function.Supplier<java.nio.file.Path> currentDir)
Creates a new DirectoriesCompleter with a supplier for the current directory.- Parameters:
currentDir
- a supplier that provides the current directory path
-
-
Method Detail
-
getUserDir
protected java.nio.file.Path getUserDir()
Gets the user's current directory.- Overrides:
getUserDir
in classCompleters.FileNameCompleter
- Returns:
- the current directory path
-
accept
protected boolean accept(java.nio.file.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 classCompleters.FileNameCompleter
- Parameters:
path
- the path to check- Returns:
- true if the path should be accepted, false otherwise
-
-