Class 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 a printHelp(InputLine) that will format and print out the help entries.

    Created by Jeff Gaynor
    on 11/26/22 at 5:47 AM

    • Constructor Detail

      • HelpUtil

        public HelpUtil()
    • Method Detail

      • setOnlineHelp

        public void setOnlineHelp​(Map<String,​String> onlineHelp)
      • setOnlineExamples

        public void setOnlineExamples​(Map<String,​String> onlineExamples)
      • 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:
      • 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
      • resolveRealHelpName

        protected String[] resolveRealHelpName​(String text)
      • 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)