public class

FileNameCompleter

extends Object
implements Completer
java.lang.Object
   ↳ jline.console.completer.FileNameCompleter

Class Overview

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

Summary

Public Constructors
FileNameCompleter()
Public Methods
int complete(String buffer, int cursor, List<CharSequence> candidates)
Populates candidates with a list of possible completions for the buffer.
Protected Methods
File getUserDir()
File getUserHome()
int matchFiles(String buffer, String translated, File[] files, List<CharSequence> candidates)
CharSequence render(File file, CharSequence name)
String separator()
[Expand]
Inherited Methods
From class java.lang.Object
From interface jline.console.completer.Completer

Public Constructors

public FileNameCompleter ()

Public Methods

public int complete (String buffer, int cursor, List<CharSequence> candidates)

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.

Parameters
buffer The buffer
cursor The current position of the cursor in the buffer
candidates The List of candidates to populate
Returns
  • The index of the buffer for which the completion will be relative

Protected Methods

protected File getUserDir ()

protected File getUserHome ()

protected int matchFiles (String buffer, String translated, File[] files, List<CharSequence> candidates)

protected CharSequence render (File file, CharSequence name)

protected String separator ()