We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
--cert option for pip-sync
pip-sync is missing the `--cert` and `--client-cert` options, that are (somehow, see #712) implemented for pip-compile.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `piptools/scripts/sync.py`
Content:
```
1 # coding: utf-8
2 from __future__ import absolute_import, division, print_function, unicode_literals
3 
4 import os
5 import sys
6 
7 from .. import click, sync
8 from .._compat import get_installed_distributions, parse_requirements
9 from ..exceptions import PipToolsError
10 from ..logging import log
11 from ..utils import flat_map
12 
13 DEFAULT_REQUIREMENTS_FILE = "requirements.txt"
14 
15 
16 @click.command()
17 @click.version_option()
18 @click.option(
19     "-n",
20     "--dry-run",
21     is_flag=True,
22     help="Only show what would happen, don't change anything",
23 )
24 @click.option("--force", is_flag=True, help="Proceed even if conflicts are found")
25 @click.option(
26     "-f",
27     "--find-links",
28     multiple=True,
29     help="Look for archives in this directory or on this HTML page",
30     envvar="PIP_FIND_LINKS",
31 )
32 @click.option(
33     "-i",
34     "--index-url",
35     help="Change index URL (defaults to PyPI)",
36     envvar="PIP_INDEX_URL",
37 )
38 @click.option(
39     "--extra-index-url",
40     multiple=True,
41     help="Add additional index URL to search",
42     envvar="PIP_EXTRA_INDEX_URL",
43 )
44 @click.option(
45     "--trusted-host",
46     multiple=True,
47     help="Mark this host as trusted, even though it does not have valid or any HTTPS.",
48 )
49 @click.option(
50     "--no-index",
51     is_flag=True,
52     help="Ignore package index (only looking at --find-links URLs instead)",
53 )
54 @click.option("-q", "--quiet", default=False, is_flag=True, help="Give less output")
55 @click.option(
56     "--user", "user_only", is_flag=True, help="Restrict attention to user directory"
57 )
58 @click.argument("src_files", required=False, type=click.Path(exists=True), nargs=-1)
59 def cli(
60     dry_run,
61     force,
62     find_links,
63     index_url,
64     extra_index_url,
65     trusted_host,
66     no_index,
67     quiet,
68     user_only,
69     src_files,
70 ):
71     """Synchronize virtual environment with requirements.txt."""
72     if not src_files:
73         if os.path.exists(DEFAULT_REQUIREMENTS_FILE):
74             src_files = (DEFAULT_REQUIREMENTS_FILE,)
75         else:
76             msg = "No requirement files given and no {} found in the current directory"
77             log.error(msg.format(DEFAULT_REQUIREMENTS_FILE))
78             sys.exit(2)
79 
80     if any(src_file.endswith(".in") for src_file in src_files):
81         msg = (
82             "Some input files have the .in extension, which is most likely an error "
83             "and can cause weird behaviour. You probably meant to use "
84             "the corresponding *.txt file?"
85         )
86         if force:
87             log.warning("WARNING: " + msg)
88         else:
89             log.error("ERROR: " + msg)
90             sys.exit(2)
91 
92     requirements = flat_map(
93         lambda src: parse_requirements(src, session=True), src_files
94     )
95 
96     try:
97         requirements = sync.merge(requirements, ignore_conflicts=force)
98     except PipToolsError as e:
99         log.error(str(e))
100         sys.exit(2)
101 
102     installed_dists = get_installed_distributions(skip=[], user_only=user_only)
103     to_install, to_uninstall = sync.diff(requirements, installed_dists)
104 
105     install_flags = []
106     for link in find_links or []:
107         install_flags.extend(["-f", link])
108     if no_index:
109         install_flags.append("--no-index")
110     if index_url:
111         install_flags.extend(["-i", index_url])
112     if extra_index_url:
113         for extra_index in extra_index_url:
114             install_flags.extend(["--extra-index-url", extra_index])
115     if trusted_host:
116         for host in trusted_host:
117             install_flags.extend(["--trusted-host", host])
118     if user_only:
119         install_flags.append("--user")
120 
121     sys.exit(
122         sync.sync(
123             to_install,
124             to_uninstall,
125             verbose=(not quiet),
126             dry_run=dry_run,
127             install_flags=install_flags,
128         )
129     )
130
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/piptools/scripts/sync.py b/piptools/scripts/sync.py
--- a/piptools/scripts/sync.py
+++ b/piptools/scripts/sync.py
@@ -55,6 +55,12 @@
 @click.option(
     "--user", "user_only", is_flag=True, help="Restrict attention to user directory"
 )
+@click.option("--cert", help="Path to alternate CA bundle.")
+@click.option(
+    "--client-cert",
+    help="Path to SSL client certificate, a single file containing "
+    "the private key and the certificate in PEM format.",
+)
 @click.argument("src_files", required=False, type=click.Path(exists=True), nargs=-1)
 def cli(
     dry_run,
@@ -66,6 +72,8 @@
     no_index,
     quiet,
     user_only,
+    cert,
+    client_cert,
     src_files,
 ):
     """Synchronize virtual environment with requirements.txt."""
@@ -117,6 +125,10 @@
             install_flags.extend(["--trusted-host", host])
     if user_only:
         install_flags.append("--user")
+    if cert:
+        install_flags.extend(["--cert", cert])
+    if client_cert:
+        install_flags.extend(["--client-cert", client_cert])
 
     sys.exit(
         sync.sync(

{"golden_diff": "diff --git a/piptools/scripts/sync.py b/piptools/scripts/sync.py\n--- a/piptools/scripts/sync.py\n+++ b/piptools/scripts/sync.py\n@@ -55,6 +55,12 @@\n @click.option(\n     \"--user\", \"user_only\", is_flag=True, help=\"Restrict attention to user directory\"\n )\n+@click.option(\"--cert\", help=\"Path to alternate CA bundle.\")\n+@click.option(\n+    \"--client-cert\",\n+    help=\"Path to SSL client certificate, a single file containing \"\n+    \"the private key and the certificate in PEM format.\",\n+)\n @click.argument(\"src_files\", required=False, type=click.Path(exists=True), nargs=-1)\n def cli(\n     dry_run,\n@@ -66,6 +72,8 @@\n     no_index,\n     quiet,\n     user_only,\n+    cert,\n+    client_cert,\n     src_files,\n ):\n     \"\"\"Synchronize virtual environment with requirements.txt.\"\"\"\n@@ -117,6 +125,10 @@\n             install_flags.extend([\"--trusted-host\", host])\n     if user_only:\n         install_flags.append(\"--user\")\n+    if cert:\n+        install_flags.extend([\"--cert\", cert])\n+    if client_cert:\n+        install_flags.extend([\"--client-cert\", client_cert])\n \n     sys.exit(\n         sync.sync(\n", "issue": "--cert option for pip-sync\npip-sync is missing the `--cert` and `--client-cert` options, that are (somehow, see #712) implemented for pip-compile.\n", "before_files": [{"content": "# coding: utf-8\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nimport os\nimport sys\n\nfrom .. import click, sync\nfrom .._compat import get_installed_distributions, parse_requirements\nfrom ..exceptions import PipToolsError\nfrom ..logging import log\nfrom ..utils import flat_map\n\nDEFAULT_REQUIREMENTS_FILE = \"requirements.txt\"\n\n\n@click.command()\n@click.version_option()\n@click.option(\n    \"-n\",\n    \"--dry-run\",\n    is_flag=True,\n    help=\"Only show what would happen, don't change anything\",\n)\n@click.option(\"--force\", is_flag=True, help=\"Proceed even if conflicts are found\")\n@click.option(\n    \"-f\",\n    \"--find-links\",\n    multiple=True,\n    help=\"Look for archives in this directory or on this HTML page\",\n    envvar=\"PIP_FIND_LINKS\",\n)\n@click.option(\n    \"-i\",\n    \"--index-url\",\n    help=\"Change index URL (defaults to PyPI)\",\n    envvar=\"PIP_INDEX_URL\",\n)\n@click.option(\n    \"--extra-index-url\",\n    multiple=True,\n    help=\"Add additional index URL to search\",\n    envvar=\"PIP_EXTRA_INDEX_URL\",\n)\n@click.option(\n    \"--trusted-host\",\n    multiple=True,\n    help=\"Mark this host as trusted, even though it does not have valid or any HTTPS.\",\n)\n@click.option(\n    \"--no-index\",\n    is_flag=True,\n    help=\"Ignore package index (only looking at --find-links URLs instead)\",\n)\n@click.option(\"-q\", \"--quiet\", default=False, is_flag=True, help=\"Give less output\")\n@click.option(\n    \"--user\", \"user_only\", is_flag=True, help=\"Restrict attention to user directory\"\n)\n@click.argument(\"src_files\", required=False, type=click.Path(exists=True), nargs=-1)\ndef cli(\n    dry_run,\n    force,\n    find_links,\n    index_url,\n    extra_index_url,\n    trusted_host,\n    no_index,\n    quiet,\n    user_only,\n    src_files,\n):\n    \"\"\"Synchronize virtual environment with requirements.txt.\"\"\"\n    if not src_files:\n        if os.path.exists(DEFAULT_REQUIREMENTS_FILE):\n            src_files = (DEFAULT_REQUIREMENTS_FILE,)\n        else:\n            msg = \"No requirement files given and no {} found in the current directory\"\n            log.error(msg.format(DEFAULT_REQUIREMENTS_FILE))\n            sys.exit(2)\n\n    if any(src_file.endswith(\".in\") for src_file in src_files):\n        msg = (\n            \"Some input files have the .in extension, which is most likely an error \"\n            \"and can cause weird behaviour. You probably meant to use \"\n            \"the corresponding *.txt file?\"\n        )\n        if force:\n            log.warning(\"WARNING: \" + msg)\n        else:\n            log.error(\"ERROR: \" + msg)\n            sys.exit(2)\n\n    requirements = flat_map(\n        lambda src: parse_requirements(src, session=True), src_files\n    )\n\n    try:\n        requirements = sync.merge(requirements, ignore_conflicts=force)\n    except PipToolsError as e:\n        log.error(str(e))\n        sys.exit(2)\n\n    installed_dists = get_installed_distributions(skip=[], user_only=user_only)\n    to_install, to_uninstall = sync.diff(requirements, installed_dists)\n\n    install_flags = []\n    for link in find_links or []:\n        install_flags.extend([\"-f\", link])\n    if no_index:\n        install_flags.append(\"--no-index\")\n    if index_url:\n        install_flags.extend([\"-i\", index_url])\n    if extra_index_url:\n        for extra_index in extra_index_url:\n            install_flags.extend([\"--extra-index-url\", extra_index])\n    if trusted_host:\n        for host in trusted_host:\n            install_flags.extend([\"--trusted-host\", host])\n    if user_only:\n        install_flags.append(\"--user\")\n\n    sys.exit(\n        sync.sync(\n            to_install,\n            to_uninstall,\n            verbose=(not quiet),\n            dry_run=dry_run,\n            install_flags=install_flags,\n        )\n    )\n", "path": "piptools/scripts/sync.py"}], "after_files": [{"content": "# coding: utf-8\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nimport os\nimport sys\n\nfrom .. import click, sync\nfrom .._compat import get_installed_distributions, parse_requirements\nfrom ..exceptions import PipToolsError\nfrom ..logging import log\nfrom ..utils import flat_map\n\nDEFAULT_REQUIREMENTS_FILE = \"requirements.txt\"\n\n\n@click.command()\n@click.version_option()\n@click.option(\n    \"-n\",\n    \"--dry-run\",\n    is_flag=True,\n    help=\"Only show what would happen, don't change anything\",\n)\n@click.option(\"--force\", is_flag=True, help=\"Proceed even if conflicts are found\")\n@click.option(\n    \"-f\",\n    \"--find-links\",\n    multiple=True,\n    help=\"Look for archives in this directory or on this HTML page\",\n    envvar=\"PIP_FIND_LINKS\",\n)\n@click.option(\n    \"-i\",\n    \"--index-url\",\n    help=\"Change index URL (defaults to PyPI)\",\n    envvar=\"PIP_INDEX_URL\",\n)\n@click.option(\n    \"--extra-index-url\",\n    multiple=True,\n    help=\"Add additional index URL to search\",\n    envvar=\"PIP_EXTRA_INDEX_URL\",\n)\n@click.option(\n    \"--trusted-host\",\n    multiple=True,\n    help=\"Mark this host as trusted, even though it does not have valid or any HTTPS.\",\n)\n@click.option(\n    \"--no-index\",\n    is_flag=True,\n    help=\"Ignore package index (only looking at --find-links URLs instead)\",\n)\n@click.option(\"-q\", \"--quiet\", default=False, is_flag=True, help=\"Give less output\")\n@click.option(\n    \"--user\", \"user_only\", is_flag=True, help=\"Restrict attention to user directory\"\n)\n@click.option(\"--cert\", help=\"Path to alternate CA bundle.\")\n@click.option(\n    \"--client-cert\",\n    help=\"Path to SSL client certificate, a single file containing \"\n    \"the private key and the certificate in PEM format.\",\n)\n@click.argument(\"src_files\", required=False, type=click.Path(exists=True), nargs=-1)\ndef cli(\n    dry_run,\n    force,\n    find_links,\n    index_url,\n    extra_index_url,\n    trusted_host,\n    no_index,\n    quiet,\n    user_only,\n    cert,\n    client_cert,\n    src_files,\n):\n    \"\"\"Synchronize virtual environment with requirements.txt.\"\"\"\n    if not src_files:\n        if os.path.exists(DEFAULT_REQUIREMENTS_FILE):\n            src_files = (DEFAULT_REQUIREMENTS_FILE,)\n        else:\n            msg = \"No requirement files given and no {} found in the current directory\"\n            log.error(msg.format(DEFAULT_REQUIREMENTS_FILE))\n            sys.exit(2)\n\n    if any(src_file.endswith(\".in\") for src_file in src_files):\n        msg = (\n            \"Some input files have the .in extension, which is most likely an error \"\n            \"and can cause weird behaviour. You probably meant to use \"\n            \"the corresponding *.txt file?\"\n        )\n        if force:\n            log.warning(\"WARNING: \" + msg)\n        else:\n            log.error(\"ERROR: \" + msg)\n            sys.exit(2)\n\n    requirements = flat_map(\n        lambda src: parse_requirements(src, session=True), src_files\n    )\n\n    try:\n        requirements = sync.merge(requirements, ignore_conflicts=force)\n    except PipToolsError as e:\n        log.error(str(e))\n        sys.exit(2)\n\n    installed_dists = get_installed_distributions(skip=[], user_only=user_only)\n    to_install, to_uninstall = sync.diff(requirements, installed_dists)\n\n    install_flags = []\n    for link in find_links or []:\n        install_flags.extend([\"-f\", link])\n    if no_index:\n        install_flags.append(\"--no-index\")\n    if index_url:\n        install_flags.extend([\"-i\", index_url])\n    if extra_index_url:\n        for extra_index in extra_index_url:\n            install_flags.extend([\"--extra-index-url\", extra_index])\n    if trusted_host:\n        for host in trusted_host:\n            install_flags.extend([\"--trusted-host\", host])\n    if user_only:\n        install_flags.append(\"--user\")\n    if cert:\n        install_flags.extend([\"--cert\", cert])\n    if client_cert:\n        install_flags.extend([\"--client-cert\", client_cert])\n\n    sys.exit(\n        sync.sync(\n            to_install,\n            to_uninstall,\n            verbose=(not quiet),\n            dry_run=dry_run,\n            install_flags=install_flags,\n        )\n    )\n", "path": "piptools/scripts/sync.py"}]}