code: def add_parser(subparsers, parent_parser):
      PARAMS_HELP = "Commands to display params."
  
      params_parser = subparsers.add_parser(
          "params",
          parents=[parent_parser],
          description=append_doc_link(PARAMS_HELP, "params"),
          help=PARAMS_HELP,
          formatter_class=formatter.RawDescriptionHelpFormatter,
      )
  
      params_subparsers = params_parser.add_subparsers(
          dest="cmd",
          help="Use `dvc params CMD --help` to display command-specific help.",
          required=True,
      )
  
      PARAMS_DIFF_HELP = (
          "Show changes in params between commits in the DVC repository, or "
          "between a commit and the workspace."
      )
      params_diff_parser = params_subparsers.add_parser(
          "diff",
          parents=[parent_parser],
          description=append_doc_link(PARAMS_DIFF_HELP, "params/diff"),
          help=PARAMS_DIFF_HELP,
          formatter_class=formatter.RawDescriptionHelpFormatter,
      )
      params_diff_parser.add_argument(
          "a_rev",
          nargs="?",
          default="HEAD",
          help="Old Git commit to compare (defaults to HEAD)",
      )
      params_diff_parser.add_argument(
          "b_rev",
          default="workspace",
          nargs="?",
          help="New Git commit to compare (defaults to the current workspace)",
      )
      params_diff_parser.add_argument(
          "--targets",
          nargs="*",
          help=(
              "Specific params file(s) to compare "
              "(even if not found as `params` in `dvc.yaml`). "
              "Shows all tracked params by default."
          ),
          metavar="<paths>",
      ).complete = completion.FILE
      params_diff_parser.add_argument(
          "--all",
          action="store_true",
          default=False,
          help="Show unchanged params as well.",
      )
      params_diff_parser.add_argument(
          "--deps",
          action="store_true",
          default=False,
          help="Show only params that are stage dependencies.",
      )
      params_diff_parser.add_argument(
          "--json",
          action="store_true",
          default=False,
          help="Show output in JSON format.",
      )
      params_diff_parser.add_argument(
          "--md",
          action="store_true",
          default=False,
          dest="markdown",
          help="Show tabulated output in the Markdown format (GFM).",
      )
      params_diff_parser.add_argument(
          "--no-path",
          action="store_true",
          default=False,
          help="Don't show params path.",
      )
      params_diff_parser.set_defaults(func=CmdParamsDiff)
  
file_path: dvc/dvc/commands/params.py
imports: from dvc.cli import completion, 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