[Groovy] Class FileNameCompleter
- org.codehaus.groovy.tools.shell.completion.FileNameCompleter
A file name completer takes the buffer and issues a list of potential completions.
This completer tries to behave as similar as possible to bash's file name completion (using GNU readline) with the following exceptions:- Candidates that are directories will end with "File.separator"
- Wildcard regular expressions are not evaluated or replaced
- The "~" character can be used to represent the user's home directory. It cannot fully complete to other users' homes in all operating systems, since java does not provide any way of determining that easily, but it will attempt a simplistic approach.
- Since:
- 2.3
Properties Summary
Type | Name and description |
---|---|
boolean |
escapeBackslash If the filename will be placed inside a single/double quoted String we must escape backslash when on e.g. |
boolean |
escapeSpaces Set false if e.g. the filename will be inside a String. |
boolean |
printSpaceAfterFullCompletion True for say, a command-line arg, false for instance inside a String. |
Constructor Summary
Constructor and description |
---|
FileNameCompleter
(boolean printSpaceAfterFullCompletion = true, boolean escapeBackslash = false, boolean escapeSpaces = true) |
Methods Summary
Type Params | Return Type | Name and description |
---|---|---|
int |
complete(String buffer, int cursor, List<CharSequence> candidates) | |
protected int |
matchFiles(String buffer, String translated, File[] files, List<CharSequence> candidates) |
Property Detail
boolean escapeBackslash
If the filename will be placed inside a single/double quoted String we must escape backslash when on e.g. Windows.
boolean escapeSpaces
Set false if e.g. the filename will be inside a String. Should not be true if quoteFilenamesWithSpaces is true.
boolean printSpaceAfterFullCompletion
True for say, a command-line arg, false for instance inside a String.
Constructor Detail
FileNameCompleter(boolean printSpaceAfterFullCompletion = true, boolean escapeBackslash = false, boolean escapeSpaces = true)
Method Detail
@Override int complete(String buffer, int cursor, List<CharSequence> candidates)
protected int matchFiles(String buffer, String translated, File[] files, List<CharSequence> candidates)
© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/2.5.14/html/gapi/org/codehaus/groovy/tools/shell/completion/FileNameCompleter.html