class_docstr: Wrapper around the standard 'getopt()' module that provides some
  handy extra functionality:
    * short and long options are tied together
    * options have help strings, and help text can be assembled
      from them
    * options set attributes of a passed-in object
    * boolean options can have "negative aliases" -- eg. if
      --quiet is the "negative alias" of --verbose, then "--quiet"
      on the command line sets 'verbose' to false
docstr: Generate help text (a list of strings, one per suggested line of
  output) from the option table for this FancyGetopt object.
docstr_tok: ["Generate","help","text","(","a","list","of","strings",",","one","per","suggested","line","of","output",")","from","the","option","table","for","this","FancyGetopt","object","."]
code: def generate_help(self, header=None):
      """Generate help text (a list of strings, one per suggested line of
      output) from the option table for this FancyGetopt object.
      """
      # Blithely assume the option table is good: probably wouldn't call
      # 'generate_help()' unless you've already called 'getopt()'.
  
      # First pass: determine maximum length of long option names
      max_opt = 0
      for option in self.option_table:
          long = option[0]
          short = option[1]
          l = len(long)
          if long[-1] == "=":
              l = l - 1
          if short is not None:
              l = l + 5  # " (-x)" where short == 'x'
          if l > max_opt:
              max_opt = l
  
      opt_width = (
          max_opt + 2 + 2 + 2
      )  # room for indent + dashes + gutter
  
      # Typical help block looks like this:
      #   --foo       controls foonabulation
      # Help block for longest option looks like this:
      #   --flimflam  set the flim-flam level
      # and with wrapped text:
      #   --flimflam  set the flim-flam level (must be between
      #               0 and 100, except on Tuesdays)
      # Options with short names will have the short name shown (but
      # it doesn't contribute to max_opt):
      #   --foo (-f)  controls foonabulation
      # If adding the short option would make the left column too wide,
      # we push the explanation off to the next line
      #   --flimflam (-l)
      #               set the flim-flam level
      # Important parameters:
      #   - 2 spaces before option block start lines
      #   - 2 dashes for each long option name
      #   - min. 2 spaces between option and explanation (gutter)
      #   - 5 characters (incl. space) for short option name
  
      # Now generate lines of help text.  (If 80 columns were good enough
      # for Jesus, then 78 columns are good enough for me!)
      line_width = 78
      text_width = line_width - opt_width
      big_indent = " " * opt_width
      if header:
          lines = [header]
      else:
          lines = ["Option summary:"]
  
      for option in self.option_table:
          long, short, help = option[:3]
          text = wrap_text(help, text_width)
          if long[-1] == "=":
              long = long[0:-1]
  
          # Case 1: no short option at all (makes life easy)
          if short is None:
              if text:
                  lines.append(
                      "  --%-*s  %s" % (max_opt, long, text[0])
                  )
              else:
                  lines.append("  --%-*s  " % (max_opt, long))
  
          # Case 2: we have a short option, so we have to include it
          # just after the long option
          else:
              opt_names = "%s (-%s)" % (long, short)
              if text:
                  lines.append(
                      "  --%-*s  %s" % (max_opt, opt_names, text[0])
                  )
              else:
                  lines.append("  --%-*s" % opt_names)
  
          for l in text[1:]:
              lines.append(big_indent + l)
      return lines
  
imports: import sys, string, re
  import getopt
  from distutils.errors import *
label_desc: Use image node_id 13 for calling the FancyGetopt obj's underlying member method code with example usage: obj.generate_help(header) and returns: lines