diff --git a/piptools/scripts/sync.py b/piptools/scripts/sync.py index f5b011523..076c965b6 100755 --- 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 @@ def cli( no_index, quiet, user_only, + cert, + client_cert, src_files, ): """Synchronize virtual environment with requirements.txt.""" @@ -117,6 +125,10 @@ def cli( 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( diff --git a/tests/test_cli_sync.py b/tests/test_cli_sync.py index 03d46ae67..2988b2f84 100644 --- a/tests/test_cli_sync.py +++ b/tests/test_cli_sync.py @@ -129,6 +129,8 @@ def test_merge_error(runner): ["--extra-index-url", "https://foo", "--trusted-host", "https://bar"], ), (["--user"], ["--user"]), + (["--cert", "foo.crt"], ["--cert", "foo.crt"]), + (["--client-cert", "foo.pem"], ["--client-cert", "foo.pem"]), ], ) @mock.patch("piptools.sync.check_call")