code: def main(argv: Sequence[str] = (), /) -> int:
      """Parse and check the command line arguments."""
      locale.setlocale(locale.LC_ALL, "")
      sphinx.locale.init_console()
  
      parser = get_parser()
      args = parser.parse_args(argv or sys.argv[1:])
  
      rootpath = path.abspath(args.module_path)
  
      # normalize opts
  
      if args.header is None:
          args.header = rootpath.split(path.sep)[-1]
      if args.suffix.startswith("."):
          args.suffix = args.suffix[1:]
      if not path.isdir(rootpath):
          logger.error(__("%s is not a directory."), rootpath)
          raise SystemExit(1)
      if not args.dryrun:
          ensuredir(args.destdir)
      excludes = tuple(
          re.compile(fnmatch.translate(path.abspath(exclude)))
          for exclude in dict.fromkeys(args.exclude_pattern)
      )
      modules = recurse_tree(rootpath, excludes, args, args.templatedir)
  
      if args.full:
          from sphinx.cmd import quickstart as qs
  
          modules.sort()
          prev_module = ""
          text = ""
          for module in modules:
              if module.startswith(prev_module + "."):
                  continue
              prev_module = module
              text += "   %s\n" % module
          d = {
              "path": args.destdir,
              "sep": False,
              "dot": "_",
              "project": args.header,
              "author": args.author or "Author",
              "version": args.version or "",
              "release": args.release or args.version or "",
              "suffix": "." + args.suffix,
              "master": "index",
              "epub": True,
              "extensions": [
                  "sphinx.ext.autodoc",
                  "sphinx.ext.viewcode",
                  "sphinx.ext.todo",
              ],
              "makefile": True,
              "batchfile": True,
              "make_mode": True,
              "mastertocmaxdepth": args.maxdepth,
              "mastertoctree": text,
              "language": "en",
              "module_path": rootpath,
              "append_syspath": args.append_syspath,
          }
          if args.extensions:
              d["extensions"].extend(args.extensions)
          if args.quiet:
              d["quiet"] = True
  
          for ext in d["extensions"][:]:
              if "," in ext:
                  d["extensions"].remove(ext)
                  d["extensions"].extend(ext.split(","))
  
          if not args.dryrun:
              qs.generate(
                  d,
                  silent=True,
                  overwrite=args.force,
                  templatedir=args.templatedir,
              )
      elif args.tocfile:
          create_modules_toc_file(
              modules, args, args.tocfile, args.templatedir
          )
  
      return 0
  
imports: from __future__ import annotations
  import argparse
  import fnmatch
  import glob
  import locale
  import os
  import re
  import sys
  from copy import copy
  from importlib.machinery import EXTENSION_SUFFIXES
  from os import path
  from typing import TYPE_CHECKING, Any
  import sphinx.locale
  from sphinx import __display_version__, package_dir
  from sphinx.cmd.quickstart import EXTENSIONS
  from sphinx.locale import __
  from sphinx.util import logging
  from sphinx.util.osutil import FileAvoidWrite, ensuredir
  from sphinx.util.template import ReSTRenderer
label_desc: Use image node_id 15 for calling a global function with example usage: main() and returns: int