org.jboss.aesh.util
public class Parser extends Object
Constructor and Description |
---|
Parser() |
Modifier and Type | Method and Description |
---|---|
static boolean |
doWordContainEscapedSpace(String word) |
static boolean |
doWordContainOnlyEscapedSpace(String word) |
static int |
findAllOccurrences(String word,
String pattern) |
static List<String> |
findAllWords(String text) |
static String |
findEscapedSpaceWordCloseToEnd(String text)
Search backwards for a non-escaped space and only return work containing non-escaped space
|
static String |
findFirstWord(String buffer)
If string contain space, return the text before the first space.
|
static boolean |
findIfWordEndWithSpace(String word) |
static String |
findStartsWith(List<String> completionList)
Return the biggest common startsWith string
|
static String |
findStartsWithOperation(List<CompleteOperation> coList)
If there is any common start string in the completion list, return it
|
static String |
findWordClosestToCursor(String text,
int cursor)
Return the word "connected" to cursor
Note that cursor position starts at 0
|
static String |
formatDisplayList(List<String> displayList,
int termHeight,
int termWidth)
Format completions so that they look similar to GNU Readline
|
static String |
formatDisplayList(String[] displayList,
int termHeight,
int termWidth)
Format completions so that they look similar to GNU Readline
|
static List<String> |
splitBySizeKeepWords(String words,
int size) |
static List<String> |
switchEscapedSpacesToSpacesInList(List<String> list) |
static String |
switchEscapedSpacesToSpacesInWord(String word) |
static String |
switchSpacesToEscapedSpacesInWord(String word) |
static String |
trim(String buffer)
Similar to String.trim(), but do not remove spaces that are escaped
|
static String |
trimOptionName(String word)
remove leading dashes from word
|
public static String formatDisplayList(String[] displayList, int termHeight, int termWidth)
displayList
- to formattermHeight
- max heighttermWidth
- max widthpublic static String formatDisplayList(List<String> displayList, int termHeight, int termWidth)
displayList
- to formattermHeight
- max heighttermWidth
- max widthpublic static boolean findIfWordEndWithSpace(String word)
public static String findStartsWithOperation(List<CompleteOperation> coList)
coList
- completion listpublic static String findStartsWith(List<String> completionList)
completionList
- list to comparepublic static String findWordClosestToCursor(String text, int cursor)
text
- to parsecursor
- positionpublic static String findEscapedSpaceWordCloseToEnd(String text)
text
- textpublic static boolean doWordContainOnlyEscapedSpace(String word)
public static boolean doWordContainEscapedSpace(String word)
public static List<String> switchEscapedSpacesToSpacesInList(List<String> list)
public static String switchSpacesToEscapedSpacesInWord(String word)
public static String switchEscapedSpacesToSpacesInWord(String word)
public static String trim(String buffer)
buffer
- inputCopyright © 2015 JBoss by Red Hat. All rights reserved.