code: def main():
      """
      Parse and check the command line arguments.
      """
      parser = optparse.OptionParser(
          usage="""usage: %prog [options] [module,]
  Note: By default this script will not overwrite already created files."""
      )
      parser.add_option(
          "-e",
          "--excludes",
          action="append",
          dest="excludes",
          default=[],
      )
      parser.add_option(
          "-l",
          "--top-level-modules",
          action="store_true",
          dest="toplevel",
          help="Generate top-level modules",
          default=False,
      )
      parser.add_option(
          "-n",
          "--doc-header",
          action="store",
          dest="header",
          help="Documentation Header (default=Project)",
          default="Project",
      )
      parser.add_option(
          "-d",
          "--dest-dir",
          action="store",
          dest="destdir",
          help="Output destination directory",
          default="",
      )
      parser.add_option(
          "-s",
          "--suffix",
          action="store",
          dest="suffix",
          help="module suffix (default=rst)",
          default="rst",
      )
      parser.add_option(
          "-m",
          "--maxdepth",
          action="store",
          dest="maxdepth",
          help="Maximum depth of submodules to show in the TOC (default=4)",
          type="int",
          default=4,
      )
      parser.add_option(
          "-r",
          "--dry-run",
          action="store_true",
          dest="dryrun",
          help="Run the script without creating the files",
      )
      parser.add_option(
          "-f",
          "--force",
          action="store_true",
          dest="force",
          help="Overwrite all the files",
      )
      parser.add_option(
          "-t",
          "--no-toc",
          action="store_true",
          dest="notoc",
          help="Don't create the table of content file",
      )
      (opts, args) = parser.parse_args()
      if not args:
          parser.error("At least one module is required.")
      else:
          modules = args
          excludes = opts.excludes
          for module in modules:
              rootpath = os.path.abspath(
                  os.path.join(__file__, "..", "..", module)
              )
              if os.path.isdir(rootpath):
                  # check if the output destination is a valid directory
                  if opts.destdir and os.path.isdir(opts.destdir):
                      excludes = normalize_excludes(rootpath, excludes)
                      recurse_tree(rootpath, excludes, opts)
                  else:
                      print(
                          "%s is not a valid output destination directory."
                          % opts.destdir
                      )
              else:
                  print("%s is not a valid directory." % rootpath)
  
file_path: holoviews/doc/generate_modules.py
imports: import os
  import optparse
label_desc: Use image node_id 13 for calling a global function with example usage: main() without return types