code: def add_parser(subparsers, parent_parser):
      GC_HELP = (
          "Garbage collect unused objects from cache or remote storage."
      )
      GC_DESCRIPTION = (
          "Removes all files in the cache or a remote which are not in\n"
          "use by the specified Git revisions (defaults to just HEAD)."
      )
      gc_parser = subparsers.add_parser(
          "gc",
          parents=[parent_parser],
          description=append_doc_link(GC_DESCRIPTION, "gc"),
          help=GC_HELP,
          formatter_class=formatter.RawDescriptionHelpFormatter,
      )
      gc_parser.add_argument(
          "-w",
          "--workspace",
          action="store_true",
          default=False,
          help="Keep data files used in the current workspace.",
      )
      gc_parser.add_argument(
          "--rev",
          type=str,
          default=None,
          help="Keep data files used in the specified <commit>.",
          metavar="<commit>",
      )
      gc_parser.add_argument(
          "-n",
          "--num",
          type=int,
          dest="num",
          metavar="<num>",
          help=(
              "Keep data files used in the last `num` commits "
              "starting from the `--rev` <commit>. "
              "Only used if `--rev` is also provided. "
              "Defaults to `1`."
          ),
      )
      gc_parser.add_argument(
          "-a",
          "--all-branches",
          action="store_true",
          default=False,
          help="Keep data files for the tips of all Git branches.",
      )
      gc_parser.add_argument(
          "-T",
          "--all-tags",
          action="store_true",
          default=False,
          help="Keep data files for all Git tags.",
      )
      gc_parser.add_argument(
          "-A",
          "--all-commits",
          action="store_true",
          default=False,
          help="Keep data files for all Git commits.",
      )
      gc_parser.add_argument(
          "--date",
          type=str,
          dest="commit_date",
          metavar="<yyyy-mm-dd>",
          default=None,
          help=(
              "Keep cached data referenced in the commits after ( inclusive )"
              " a certain time. Date must match the extended ISO 8601 format "
              "(yyyy-mm-dd)."
          ),
      )
      gc_parser.add_argument(
          "--all-experiments",
          action="store_true",
          default=False,
          help="Keep data files for all experiments.",
      )
      gc_parser.add_argument(
          "--not-in-remote",
          action="store_true",
          default=False,
          help="Keep data files that are not present in the remote.",
      )
      gc_parser.add_argument(
          "-c",
          "--cloud",
          action="store_true",
          default=False,
          help="Collect garbage in remote storage in addition to local cache.",
      )
      gc_parser.add_argument(
          "-r",
          "--remote",
          help="Remote storage to collect garbage in",
          metavar="<name>",
      )
      gc_parser.add_argument(
          "--skip-failed",
          action="store_true",
          default=False,
          help="Skip revisions that fail when collected.",
      )
      gc_parser.add_argument(
          "-f",
          "--force",
          action="store_true",
          default=False,
          help="Force garbage collection - automatically agree to all prompts.",
      )
      gc_parser.add_argument(
          "-j",
          "--jobs",
          type=int,
          help=(
              "Number of jobs to run simultaneously. "
              "The default value is 4 * cpu_count(). "
          ),
          metavar="<number>",
      )
      gc_parser.add_argument(
          "-p",
          "--projects",
          dest="repos",
          type=str,
          nargs="*",
          help=(
              "Keep data files required by these projects "
              "in addition to the current one. "
              "Useful if you share a single cache across repos."
          ),
          metavar="<paths>",
      )
      gc_parser.add_argument(
          "--dry",
          action="store_true",
          default=False,
          help=(
              "Only print what would get removed without actually removing."
          ),
      )
      gc_parser.set_defaults(func=CmdGC)
  
file_path: dvc/dvc/commands/gc.py
imports: import os
  from dvc.cli import formatter
  from dvc.cli.command import CmdBase
  from dvc.cli.utils import append_doc_link
  from dvc.log import logger
  from dvc.ui import ui
label_desc: Use image node_id 1 for calling a global function with example usage: add_parser(subparsers, parent_parser) without return types