code: def _cli_capi(parser):
      parser.add_argument(
          "--levels", action="append", metavar="LEVEL[,...]"
      )
      parser.add_argument(
          f"--public",
          dest="levels",
          action="append_const",
          const="public",
      )
      parser.add_argument(
          f"--no-public",
          dest="levels",
          action="append_const",
          const="no-public",
      )
      for level in _capi.LEVELS:
          parser.add_argument(
              f"--{level}",
              dest="levels",
              action="append_const",
              const=level,
          )
  
      def process_levels(args, *, argv=None):
          levels = []
          for raw in args.levels or ():
              for level in raw.replace(",", " ").strip().split():
                  if level == "public":
                      levels.append("stable")
                      levels.append("cpython")
                  elif level == "no-public":
                      levels.append("private")
                      levels.append("internal")
                  elif level in _capi.LEVELS:
                      levels.append(level)
                  else:
                      parser.error(
                          f"expected LEVEL to be one of {sorted(_capi.LEVELS)}, got {level!r}"
                      )
          args.levels = set(levels)
  
      parser.add_argument(
          "--kinds", action="append", metavar="KIND[,...]"
      )
      for kind in _capi.KINDS:
          parser.add_argument(
              f"--{kind}",
              dest="kinds",
              action="append_const",
              const=kind,
          )
  
      def process_kinds(args, *, argv=None):
          kinds = []
          for raw in args.kinds or ():
              for kind in raw.replace(",", " ").strip().split():
                  if kind in _capi.KINDS:
                      kinds.append(kind)
                  else:
                      parser.error(
                          f"expected KIND to be one of {sorted(_capi.KINDS)}, got {kind!r}"
                      )
          args.kinds = set(kinds)
  
      parser.add_argument(
          "--group-by", dest="groupby", choices=["level", "kind"]
      )
  
      parser.add_argument("--format", default="table")
      parser.add_argument(
          "--summary",
          dest="format",
          action="store_const",
          const="summary",
      )
  
      def process_format(args, *, argv=None):
          orig = args.format
          args.format = _capi.resolve_format(args.format)
          if isinstance(args.format, str):
              if args.format not in _capi._FORMATS:
                  parser.error(f"unsupported format {orig!r}")
  
      parser.add_argument(
          "--show-empty", dest="showempty", action="store_true"
      )
      parser.add_argument(
          "--no-show-empty", dest="showempty", action="store_false"
      )
      parser.set_defaults(showempty=None)
  
      # XXX Add --sort-by, --sort and --no-sort.
  
      parser.add_argument("--ignore", dest="ignored", action="append")
  
      def process_ignored(args, *, argv=None):
          ignored = []
          for raw in args.ignored or ():
              ignored.extend(raw.replace(",", " ").strip().split())
          args.ignored = ignored or None
  
      parser.add_argument("filenames", nargs="*", metavar="FILENAME")
      process_progress = add_progress_cli(parser)
  
      return [
          process_levels,
          process_kinds,
          process_format,
          process_ignored,
          process_progress,
      ]
  
imports: import logging
  import sys
  import textwrap
  from c_common.scriptutil import VERBOSITY, add_verbosity_cli, add_traceback_cli, add_commands_cli, add_kind_filtering_cli, add_files_cli, add_progress_cli, process_args_by_key, configure_logger, get_prog
  from c_parser.info import KIND
  import c_parser.__main__
  import c_analyzer.__main__
  import c_analyzer
  from c_analyzer.info import UNKNOWN
  from .None import _analyzer, _builtin_types, _capi, _files, _parser, REPO_ROOT
label_desc: Use image node_id 10 for calling a global function with example usage: _cli_capi(parser) and returns: list