Package org.jboss.as.cli.handlers
Class FilenameTabCompleter
- java.lang.Object
-
- org.jboss.as.cli.handlers.FilenameTabCompleter
-
- All Implemented Interfaces:
CommandLineCompleter
- Direct Known Subclasses:
DefaultFilenameTabCompleter,WindowsFilenameTabCompleter
public abstract class FilenameTabCompleter extends Object implements CommandLineCompleter
- Author:
- Alexey Loubyansky
-
-
Constructor Summary
Constructors Constructor Description FilenameTabCompleter(CommandContext ctx)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcomplete(CommandContext ctx, String buffer, int cursor, List<String> candidates)static Stringexpand(String path)protected intgetCandidates(String buffer, List<String> candidates)protected intmatchFiles(String buffer, String translated, File[] entries, List<String> candidates)Match the specified buffer to the array of entries and enter the matches into the list of candidates.static FilenameTabCompleternewCompleter(CommandContext ctx)StringtranslatePath(String path)Translate a path that has previously been unescaped and unquoted.
-
-
-
Constructor Detail
-
FilenameTabCompleter
public FilenameTabCompleter(CommandContext ctx)
-
-
Method Detail
-
newCompleter
public static FilenameTabCompleter newCompleter(CommandContext ctx)
-
translatePath
public String translatePath(String path)
Translate a path that has previously been unescaped and unquoted. That is called at command execution when the calue is retrieved prior to be used as ModelNode value.- Parameters:
path- The unquoted, unescaped path.- Returns:
- A path with ~ and default dir expanded.
-
matchFiles
protected int matchFiles(String buffer, String translated, File[] entries, List<String> candidates)
Match the specified buffer to the array of entries and enter the matches into the list of candidates. This method can be overridden in a subclass that wants to do more sophisticated file name completion.- Parameters:
buffer- the untranslated buffertranslated- the buffer with common characters replacedentries- the list of files to matchcandidates- the list of candidates to populate- Returns:
- the offset of the match
-
expand
public static String expand(String path) throws IOException
- Throws:
IOException
-
complete
public int complete(CommandContext ctx, String buffer, int cursor, List<String> candidates)
- Specified by:
completein interfaceCommandLineCompleter
-
-