Package org.jline.builtins
Class Completers.FilesCompleter
- java.lang.Object
-
- org.jline.builtins.Completers.FileNameCompleter
-
- org.jline.builtins.Completers.FilesCompleter
-
- All Implemented Interfaces:
org.jline.reader.Completer
- Enclosing class:
- Completers
public static class Completers.FilesCompleter extends Completers.FileNameCompleter
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
Constructors Constructor Description FilesCompleter(java.io.File currentDir)
Creates a new FilesCompleter with the specified current directory.FilesCompleter(java.io.File currentDir, java.lang.String namePattern)
Creates a new FilesCompleter with the specified current directory and name pattern.FilesCompleter(java.nio.file.Path currentDir)
Creates a new FilesCompleter with the specified current directory.FilesCompleter(java.nio.file.Path currentDir, java.lang.String namePattern)
Creates a new FilesCompleter with the specified current directory and name pattern.FilesCompleter(java.util.function.Supplier<java.nio.file.Path> currentDir)
Creates a new FilesCompleter with a supplier for the current directory.FilesCompleter(java.util.function.Supplier<java.nio.file.Path> currentDir, java.lang.String namePattern)
Creates a new FilesCompleter with a supplier for the current directory and name pattern.
-
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
-
FilesCompleter
public FilesCompleter(java.io.File currentDir)
Creates a new FilesCompleter with the specified current directory.- Parameters:
currentDir
- the current directory as a File
-
FilesCompleter
public FilesCompleter(java.io.File currentDir, java.lang.String namePattern)
Creates a new FilesCompleter with the specified current directory and name pattern.- Parameters:
currentDir
- the current directory as a FilenamePattern
- the pattern to filter file names
-
FilesCompleter
public FilesCompleter(java.nio.file.Path currentDir)
Creates a new FilesCompleter with the specified current directory.- Parameters:
currentDir
- the current directory as a Path
-
FilesCompleter
public FilesCompleter(java.nio.file.Path currentDir, java.lang.String namePattern)
Creates a new FilesCompleter with the specified current directory and name pattern.- Parameters:
currentDir
- the current directory as a PathnamePattern
- the pattern to filter file names
-
FilesCompleter
public FilesCompleter(java.util.function.Supplier<java.nio.file.Path> currentDir)
Creates a new FilesCompleter with a supplier for the current directory.- Parameters:
currentDir
- a supplier that provides the current directory path
-
FilesCompleter
public FilesCompleter(java.util.function.Supplier<java.nio.file.Path> currentDir, java.lang.String namePattern)
Creates a new FilesCompleter with a supplier for the current directory and name pattern.- Parameters:
currentDir
- a supplier that provides the current directory pathnamePattern
- the pattern to filter file names
-
-
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.Accepts directories unconditionally, and files that match the name pattern if one is specified.
- Overrides:
accept
in classCompleters.FileNameCompleter
- Parameters:
path
- the path to check- Returns:
- true if the path should be accepted, false otherwise
-
-