Package org.jline.builtins
Class Completers.FilesCompleter
java.lang.Object
org.jline.builtins.Completers.FileNameCompleter
org.jline.builtins.Completers.FilesCompleter
- All Implemented Interfaces:
Completer
- Enclosing class:
Completers
A completer for file names.
This completer provides completion for file paths, with optional filtering by name pattern. It extends FileNameCompleter and overrides the accept method to filter files by pattern.
-
Constructor Summary
ConstructorsConstructorDescriptionFilesCompleter(File currentDir) Creates a new FilesCompleter with the specified current directory.FilesCompleter(File currentDir, String namePattern) Creates a new FilesCompleter with the specified current directory and name pattern.FilesCompleter(Path currentDir) Creates a new FilesCompleter with the specified current directory.FilesCompleter(Path currentDir, String namePattern) Creates a new FilesCompleter with the specified current directory and name pattern.FilesCompleter(Supplier<Path> currentDir) Creates a new FilesCompleter with a supplier for the current directory.FilesCompleter(Supplier<Path> currentDir, String namePattern) Creates a new FilesCompleter with a supplier for the current directory and name pattern. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanDetermines if a path should be accepted for completion.protected PathGets the user's current directory.Methods inherited from class org.jline.builtins.Completers.FileNameCompleter
complete, getDisplay, getSeparator, getUserHome
-
Constructor Details
-
FilesCompleter
Creates a new FilesCompleter with the specified current directory.- Parameters:
currentDir- the current directory as a File
-
FilesCompleter
-
FilesCompleter
Creates a new FilesCompleter with the specified current directory.- Parameters:
currentDir- the current directory as a Path
-
FilesCompleter
-
FilesCompleter
-
FilesCompleter
-
-
Method Details
-
getUserDir
Gets the user's current directory.- Overrides:
getUserDirin classCompleters.FileNameCompleter- Returns:
- the current directory path
-
accept
Determines if a path should be accepted for completion.Accepts directories unconditionally, and files that match the name pattern if one is specified.
- Overrides:
acceptin classCompleters.FileNameCompleter- Parameters:
path- the path to check- Returns:
- true if the path should be accepted, false otherwise
-