From fc51289fbabf85fc2b52b427f5a341d88478c73a Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Tue, 23 Jun 2026 06:16:27 -0400 Subject: [PATCH] add back hidden CLI arguments for recent removals Click supports hidden+deprecated CLI arguments which are not advertised in the helpdoc. To make breaking changes easier and clearer, we can accept the recently removed SSL and SSH CLI arguments in hidden+deprecated mode. If such an option is given, the user gets a message like the following, in red: DeprecationWarning: The option 'ssl' is deprecated. No effect. See --ssl-mode. We should still ultimately remove (or reimplement) these hidden arguments, since click's "hidden" property is incomplete: the hidden arguments are still advertised in spelling-correction mode. --- mycli/main.py | 54 +++++++++++++++++++++++++++++++++++++++ test/pytests/test_main.py | 2 ++ 2 files changed, 56 insertions(+) diff --git a/mycli/main.py b/mycli/main.py index 2e7ae1b8..a479e0fe 100755 --- a/mycli/main.py +++ b/mycli/main.py @@ -266,6 +266,60 @@ class CliArgs: is_flag=True, help='Run a checkup on your configuration.', ) + # hidden options which have no effect as of mycli 2.0.0, 2026-07. + # todo: remove the hidden options, since they are still advertised + # in spelling corrections. + ssl: bool | None = clickdc.option( + '--ssl/--no-ssl', + clickdc=None, + hidden=True, + deprecated='No effect. See --ssl-mode.', + ) + ssh_user: str | None = clickdc.option( + type=str, + hidden=True, + deprecated='No effect. See https://github.com/dbcli/mycli/issues/1960 .', + ) + ssh_host: str | None = clickdc.option( + type=str, + hidden=True, + deprecated='No effect. See https://github.com/dbcli/mycli/issues/1960 .', + ) + ssh_port: int = clickdc.option( + type=int, + hidden=True, + deprecated='No effect. See https://github.com/dbcli/mycli/issues/1960 .', + ) + ssh_password: str | None = clickdc.option( + type=str, + hidden=True, + deprecated='No effect. See https://github.com/dbcli/mycli/issues/1960 .', + ) + ssh_key_filename: str | None = clickdc.option( + type=str, + hidden=True, + deprecated='No effect. See https://github.com/dbcli/mycli/issues/1960 .', + ) + ssh_config_path: str = clickdc.option( + type=str, + hidden=True, + deprecated='No effect. See https://github.com/dbcli/mycli/issues/1960 .', + ) + ssh_config_host: str | None = clickdc.option( + type=str, + hidden=True, + deprecated='No effect. See https://github.com/dbcli/mycli/issues/1960 .', + ) + list_ssh_config: bool = clickdc.option( + is_flag=True, + hidden=True, + deprecated='No effect. See https://github.com/dbcli/mycli/issues/1960 .', + ) + ssh_warning_off: bool = clickdc.option( + is_flag=True, + hidden=True, + deprecated='No effect. See https://github.com/dbcli/mycli/issues/1960 .', + ) def get_password_from_file(password_file: str | None) -> str | None: diff --git a/test/pytests/test_main.py b/test/pytests/test_main.py index 933d1fb7..7c5e14e8 100644 --- a/test/pytests/test_main.py +++ b/test/pytests/test_main.py @@ -772,6 +772,8 @@ def test_help_strings_end_with_periods(): """Make sure click options have help text that end with a period.""" for param in click_entrypoint.params: if isinstance(param, click.core.Option): + if param.hidden: + continue assert hasattr(param, "help") assert param.help.endswith(".")