Class Help

java.lang.Object
com.github.sttk.cliargs.Help

public class Help extends Object
Is the class to print a help text with an OptCfg array.

This class can output with margins and indentation for each option and text block.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs an instance of this class with 0 margins.
    Help(int marginLeft, int marginRight)
    Constructs an instance of this class with left and right margins.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addOpts(OptCfg[] cfgs)
    Adds OptCfg(s) for a help option block to this help instance.
    void
    Adds OptCfg(s) for a help option block to this help instance.
    void
    addOptsWithIndent(OptCfg[] cfgs, int indent)
    Adds OptCfg(s) and an indent width for a help option block to this help instance.
    void
    addOptsWithIndent(List<OptCfg> cfgs, int indent)
    Adds OptCfg(s) and an indent width for a help option block to this help instance.
    void
    addOptsWithIndentAndMargins(OptCfg[] cfgs, int indent, int marginLeft, int marginRight)
    Adds OptCfg(s) and an indent width and margins for a help option block to this help instance.
    void
    addOptsWithIndentAndMargins(List<OptCfg> cfgs, int indent, int marginLeft, int marginRight)
    Adds OptCfg(s) and an indent width and margins for a help option block to this help instance.
    void
    addOptsWithMargins(OptCfg[] cfgs, int marginLeft, int marginRight)
    Adds OptCfg(s) and an indent width and margins for a help option block to this help instance.
    void
    addOptsWithMargins(List<OptCfg> cfgs, int marginLeft, int marginRight)
    Adds OptCfg(s) and an indent width and margins for a help option block to this help instance.
    void
    Adds a text for a help text block to this help instance.
    void
    addTexts(String... texts)
    Adds texts for a help text block to this help instance.
    void
    Adds texts for a help text block to this help instance.
    void
    addTextsWithIndent(String[] texts, int indent)
    Adds texts and an indent width for a help text block to this help instance.
    void
    addTextsWithIndent(List<String> texts, int indent)
    Adds texts and an indent width for a help text block to this help instance.
    void
    addTextsWithIndentAndMargins(String[] texts, int indent, int marginLeft, int marginRight)
    Adds texts and an indent width and margins for a help text block to this help instance.
    void
    addTextsWithIndentAndMargins(List<String> texts, int indent, int marginLeft, int marginRight)
    Adds texts and an indent width and margins for a help text block to this help instance.
    void
    addTextsWithMargins(String[] texts, int marginLeft, int marginRight)
    Adds texts and an indent width and margins for a help text block to this help instance.
    void
    addTextsWithMargins(List<String> texts, int marginLeft, int marginRight)
    Adds texts and an indent width and margins for a help text block to this help instance.
    void
    addTextWithIndent(String text, int indent)
    Adds a text and an indent width for a help text block to this help instance.
    void
    addTextWithIndentAndMargins(String text, int indent, int marginLeft, int marginRight)
    Adds a text and an indent width and margins for a help text block to this help instance.
    void
    addTextWithMargins(String text, int marginLeft, int marginRight)
    Adds a text and margins for a help text block to this help instance.
    Creates a HelpIter instance which is an iterator that outputs a help text line by line.
    void
    Outputs a help text to the standard output.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Help

      public Help()
      Constructs an instance of this class with 0 margins.
    • Help

      public Help(int marginLeft, int marginRight)
      Constructs an instance of this class with left and right margins.
      Parameters:
      marginLeft - A left margin.
      marginRight - A right margin.
  • Method Details

    • addText

      public void addText(String text)
      Adds a text for a help text block to this help instance. The indent width of this help text block is set to auto indentation. The margins of a help text generated by this instance equals them which specified at a constructor.
      Parameters:
      text - A text for a help text block.
    • addTextWithIndent

      public void addTextWithIndent(String text, int indent)
      Adds a text and an indent width for a help text block to this help instance. The indent width is the number of spaces inserted at the beginning of each line from the second line. The margins of a help text generated by this instance equals them which specified at a constructor.
      Parameters:
      text - A text for a help text block.
      indent - An indent size.
    • addTextWithMargins

      public void addTextWithMargins(String text, int marginLeft, int marginRight)
      Adds a text and margins for a help text block to this help instance. The margins of this help text block generated by this instance equals the sum of them specified as parameters of this method and them which specified at a constructor. The indent width of this help text block is set to *auto indentation*.
      Parameters:
      text - A text for a help text block.
      marginLeft - A left margin.
      marginRight - A right margin.
    • addTextWithIndentAndMargins

      public void addTextWithIndentAndMargins(String text, int indent, int marginLeft, int marginRight)
      Adds a text and an indent width and margins for a help text block to this help instance. The indent width is the number of spaces inserted at the beginning of each line from the second line. The margins of this help text block generated by this instance equals the sum of them specified as parameters of this method and them which specified at a constructor.
      Parameters:
      text - A text for a help text block.
      indent - An indent size.
      marginLeft - A left margin.
      marginRight - A right margin.
    • addTexts

      public void addTexts(String... texts)
      Adds texts for a help text block to this help instance. The indent width of this help text block is set to *auto indentation*. The margins of a help text generated by this instance equals them which specified at a constructor.
      Parameters:
      texts - Texts for a help text block.
    • addTexts

      public void addTexts(List<String> texts)
      Adds texts for a help text block to this help instance. The indent width of this help text block is set to *auto indentation*. The margins of a help text generated by this instance equals them which specified at a constructor.
      Parameters:
      texts - Texts for a help text block.
    • addTextsWithIndent

      public void addTextsWithIndent(String[] texts, int indent)
      Adds texts and an indent width for a help text block to this help instance. The indent width is the number of spaces inserted at the beginning of each line from the second line. The margins of a help text generated by this instance equals them which specified at the `new` function.
      Parameters:
      texts - Texts for a help text block.
      indent - An indent size.
    • addTextsWithIndent

      public void addTextsWithIndent(List<String> texts, int indent)
      Adds texts and an indent width for a help text block to this help instance. The indent width is the number of spaces inserted at the beginning of each line from the second line. The margins of a help text generated by this instance equals them which specified at the `new` function.
      Parameters:
      texts - Texts for a help text block.
      indent - An indent size.
    • addTextsWithMargins

      public void addTextsWithMargins(String[] texts, int marginLeft, int marginRight)
      Adds texts and an indent width and margins for a help text block to this help instance. The margins of this help text block generated by this instance equals the sum of them specified as parameters of this method and them which specified at a constructor. The indent width of this help text block is set to *auto indentation*.
      Parameters:
      texts - Texts for a help text block.
      marginLeft - A left margin.
      marginRight - A right margin.
    • addTextsWithMargins

      public void addTextsWithMargins(List<String> texts, int marginLeft, int marginRight)
      Adds texts and an indent width and margins for a help text block to this help instance. The margins of this help text block generated by this instance equals the sum of them specified as parameters of this method and them which specified at a constructor. The indent width of this help text block is set to *auto indentation*.
      Parameters:
      texts - Texts for a help text block.
      marginLeft - A left margin.
      marginRight - A right margin.
    • addTextsWithIndentAndMargins

      public void addTextsWithIndentAndMargins(String[] texts, int indent, int marginLeft, int marginRight)
      Adds texts and an indent width and margins for a help text block to this help instance. The indent width is the number of spaces inserted at the beginning of each line from the second line. The margins of this help text block generated by this instance equals the sum of them specified as parameters of this method and them which specified at a constructor.
      Parameters:
      texts - Texts for a help text block.
      indent - An indent size.
      marginLeft - A left margin.
      marginRight - A right margin.
    • addTextsWithIndentAndMargins

      public void addTextsWithIndentAndMargins(List<String> texts, int indent, int marginLeft, int marginRight)
      Adds texts and an indent width and margins for a help text block to this help instance. The indent width is the number of spaces inserted at the beginning of each line from the second line. The margins of this help text block generated by this instance equals the sum of them specified as parameters of this method and them which specified at a constructor.
      Parameters:
      texts - Texts for a help text block.
      indent - An indent size.
      marginLeft - A left margin.
      marginRight - A right margin.
    • addOpts

      public void addOpts(OptCfg[] cfgs)
      Adds OptCfg(s) for a help option block to this help instance. The indent width of this help text block is set to *auto indentation*. The margins of a help text generated by this instance equals them which specified at a constructor.
      Parameters:
      cfgs - An array of OptCfg
    • addOpts

      public void addOpts(List<OptCfg> cfgs)
      Adds OptCfg(s) for a help option block to this help instance. The indent width of this help text block is set to *auto indentation*. The margins of a help text generated by this instance equals them which specified at a constructor.
      Parameters:
      cfgs - A list of OptCfg.
    • addOptsWithIndent

      public void addOptsWithIndent(OptCfg[] cfgs, int indent)
      Adds OptCfg(s) and an indent width for a help option block to this help instance. The indent width is the number of spaces inserted at the beginning of each line from the second line. The margins of a help text generated by this instance equals them which specified at a constructor.
      Parameters:
      cfgs - An array of OptCfg.
      indent - An indent size.
    • addOptsWithIndent

      public void addOptsWithIndent(List<OptCfg> cfgs, int indent)
      Adds OptCfg(s) and an indent width for a help option block to this help instance. The indent width is the number of spaces inserted at the beginning of each line from the second line. The margins of a help text generated by this instance equals them which specified at a constructor.
      Parameters:
      cfgs - A list of OptCfg.
      indent - An indent size.
    • addOptsWithMargins

      public void addOptsWithMargins(OptCfg[] cfgs, int marginLeft, int marginRight)
      Adds OptCfg(s) and an indent width and margins for a help option block to this help instance. The margins of this help text block generated by this instance equals the sum of them specified as parameters of this method and them which specified at a constructor. The indent width of this help text block is set to *auto indentation*.
      Parameters:
      cfgs - An array of OptCfg
      marginLeft - A left margin.
      marginRight - A right margin.
    • addOptsWithMargins

      public void addOptsWithMargins(List<OptCfg> cfgs, int marginLeft, int marginRight)
      Adds OptCfg(s) and an indent width and margins for a help option block to this help instance. The margins of this help text block generated by this instance equals the sum of them specified as parameters of this method and them which specified at a constructor. The indent width of this help text block is set to *auto indentation*.
      Parameters:
      cfgs - A list of OptCfg.
      marginLeft - A left margin.
      marginRight - A right margin.
    • addOptsWithIndentAndMargins

      public void addOptsWithIndentAndMargins(OptCfg[] cfgs, int indent, int marginLeft, int marginRight)
      Adds OptCfg(s) and an indent width and margins for a help option block to this help instance. The indent width is the number of spaces inserted at the beginning of each line from the second line. The margins of this help text block generated by this instance equals the sum of them specified as parameters of this method and them which specified at a constructor.
      Parameters:
      cfgs - An array of OptCfg
      indent - An indent size.
      marginLeft - A left margin.
      marginRight - A right margin.
    • addOptsWithIndentAndMargins

      public void addOptsWithIndentAndMargins(List<OptCfg> cfgs, int indent, int marginLeft, int marginRight)
      Adds OptCfg(s) and an indent width and margins for a help option block to this help instance. The indent width is the number of spaces inserted at the beginning of each line from the second line. The margins of this help text block generated by this instance equals the sum of them specified as parameters of this method and them which specified at a constructor.
      Parameters:
      cfgs - A list of OptCfg.
      indent - An indent size.
      marginLeft - A left margin.
      marginRight - A right margin.
    • iter

      public Iterator<String> iter()
      Creates a HelpIter instance which is an iterator that outputs a help text line by line.
      Returns:
      An iterator of each line of a help text.
    • print

      public void print()
      Outputs a help text to the standard output.