0

I'm trying to add a functionality where users can lookup documentation for commands - its a command line based program with various commands they can enter.

I think the simplest thing to do is store the docs in an external file but I'm not sure what my best option would be. Text files just seem a bit sloppy, csv is more what I had in mind but dealing with commas in the docs is also not ideal. A dictionary(like json) would be great but I'm not sure how I could read it with Java. I can't use 3rd part libraries.

DAnsermino
  • 363
  • 4
  • 17
  • Do you want a simple `Readme` file the user would load into their favorite text editor and read or some mechanism (like a man page) that your program would provide? – MadProgrammer Feb 25 '16 at 22:20
  • The program is all in the command line. Its basically the 'man' function. – DAnsermino Feb 25 '16 at 22:41

1 Answers1

0

I think you need to write javadocs comments and then export it (if you want). User can also access the documentation for commands when using your libraries.

Tutorial

Example:

/**
 * Returns an Image object that can then be painted on the screen. 
 * The url argument must specify an absolute {@link URL}. The name
 * argument is a specifier that is relative to the url argument. 
 * <p>
 * This method always returns immediately, whether or not the 
 * image exists. When this applet attempts to draw the image on
 * the screen, the data will be loaded. The graphics primitives 
 * that draw the image will incrementally paint on the screen. 
 *
 * @param  url  an absolute URL giving the base location of the image
 * @param  name the location of the image, relative to the url argument
 * @return      the image at the specified URL
 * @see         Image
 */
 public Image getImage(URL url, String name) {
        try {
            return getImage(new URL(url, name));
        } catch (MalformedURLException e) {
            return null;
        }
 }

Export javadocs to html

Community
  • 1
  • 1
T D Nguyen
  • 7,054
  • 4
  • 51
  • 71