jline.console.completer
Class FileNameCompleter
java.lang.Object
jline.console.completer.FileNameCompleter
- All Implemented Interfaces:
- Completer
public class FileNameCompleter
- extends Object
- implements Completer
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 "/"
- Wildcard regular expressions are not evaluated or replaced
- The "~" character can be used to represent the user's home,
but it cannot complete to other users' homes, since java does
not provide any way of determining that easily
- Since:
- 2.3
- Author:
- Marc Prud'hommeaux, Jason Dillon
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileNameCompleter
public FileNameCompleter()
complete
public int complete(String buffer,
int cursor,
List<CharSequence> candidates)
- Description copied from interface:
Completer
- Populates candidates with a list of possible completions for the buffer.
The candidates list will not be sorted before being displayed to the user: thus, the
complete method should sort the
List
before returning.
- Specified by:
complete
in interface Completer
- Parameters:
buffer
- The buffercursor
- The current position of the cursor in the buffercandidates
- The List
of candidates to populate
- Returns:
- The index of the buffer for which the completion will be relative
separator
protected String separator()
getUserHome
protected File getUserHome()
getUserDir
protected File getUserDir()
matchFiles
protected int matchFiles(String buffer,
String translated,
File[] files,
List<CharSequence> candidates)
render
protected CharSequence render(File file,
CharSequence name)
Copyright © 2008-2011 Sonatype. All Rights Reserved.