Package edu.uiuc.ncsa.security.util.cli
Class HelpUtil
- java.lang.Object
-
- edu.uiuc.ncsa.security.util.cli.HelpUtil
-
public class HelpUtil extends Object
A very simple help facility for CLIs. This takes an HTML help file and turns it into help entries. It then has aprintHelp(InputLine)
that will format and print out the help entries.Created by Jeff Gaynor
on 11/26/22 at 5:47 AM
-
-
Field Summary
Fields Modifier and Type Field Description static String
ONLINE_HELP_COMMAND
static String
ONLINE_HELP_EXAMPLE_FLAG
-
Constructor Summary
Constructors Constructor Description HelpUtil()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DoubleHashMap<String,String>
getAltLookup()
This is a mop with key being the topic, value being the alternative, e.g.String
getHelpTopic(String text)
Use this to get help for a topic.String
getHelpTopicExample(String text)
Use this to get an example for a topic.Map<String,String>
getOnlineExamples()
Map<String,String>
getOnlineHelp()
static Map<String,String>
getReverseCharLookupMap()
This is a map that allows you to specify special characters as alternates for help topics.boolean
load(InputStream helpStream)
Loads the given InputStream containing the help file.boolean
load(String helpFile)
Loads the given resource, e.g.static void
main(String[] args)
boolean
printHelp(InputLine inputLine)
Returns true if there were results printed, false otherwise.protected String[]
resolveRealHelpName(String text)
void
setAltLookup(DoubleHashMap<String,String> altLookup)
void
setOnlineExamples(Map<String,String> onlineExamples)
void
setOnlineHelp(Map<String,String> onlineHelp)
static void
setReverseCharLookupMap(Map<String,String> reverseCharLookupMap)
-
-
-
Field Detail
-
ONLINE_HELP_EXAMPLE_FLAG
public static final String ONLINE_HELP_EXAMPLE_FLAG
- See Also:
- Constant Field Values
-
ONLINE_HELP_COMMAND
public static final String ONLINE_HELP_COMMAND
- See Also:
- Constant Field Values
-
-
Method Detail
-
getAltLookup
public DoubleHashMap<String,String> getAltLookup()
This is a mop with key being the topic, value being the alternative, e.g. has_value vs. ∈ in QDL.- Returns:
-
setAltLookup
public void setAltLookup(DoubleHashMap<String,String> altLookup)
-
load
public boolean load(String helpFile) throws Throwable
Loads the given resource, e.g. "/func_help.xml" from the resources folder.- Parameters:
helpFile
-- Returns:
- Throws:
Throwable
-
load
public boolean load(InputStream helpStream) throws Throwable
Loads the given InputStream containing the help file.- Parameters:
helpStream
-- Returns:
- Throws:
Throwable
-
printHelp
public boolean printHelp(InputLine inputLine)
Returns true if there were results printed, false otherwise.- Parameters:
inputLine
-- Returns:
-
getHelpTopicExample
public String getHelpTopicExample(String text)
Use this to get an example for a topic. It returns null if no such example.- Parameters:
text
-- Returns:
-
getHelpTopic
public String getHelpTopic(String text)
Use this to get help for a topic. It returns null if no such topic.- Parameters:
text
-- Returns:
-
getReverseCharLookupMap
public static Map<String,String> getReverseCharLookupMap()
This is a map that allows you to specify special characters as alternates for help topics. E.g. "∈" for "has_a". Normally (e.g. QDL) this is done in the terminal where this map is constructed, then you set a pointer to it here.- Returns:
-
setReverseCharLookupMap
public static void setReverseCharLookupMap(Map<String,String> reverseCharLookupMap)
-
-