From: jmcb Date: Wed, 31 May 2023 21:29:31 +0000 (+0100) Subject: blackd: show default values for options (#3712) X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/a538ab76636bbe71b7fbfeaf56fd8e61805df38f blackd: show default values for options (#3712) * blackd: show default values for options Reference: https://click.palletsprojects.com/en/8.1.x/api/#click.Option * Fix spacing in CHANGES.md --- diff --git a/CHANGES.md b/CHANGES.md index 6a9923f..762a799 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -44,6 +44,9 @@ +- The `blackd` argument parser now shows the default values for options in their help + text (#3712) + ### Integrations diff --git a/src/blackd/__init__.py b/src/blackd/__init__.py index ba4750b..d331ad0 100644 --- a/src/blackd/__init__.py +++ b/src/blackd/__init__.py @@ -59,9 +59,15 @@ class InvalidVariantHeader(Exception): @click.command(context_settings={"help_option_names": ["-h", "--help"]}) @click.option( - "--bind-host", type=str, help="Address to bind the server to.", default="localhost" + "--bind-host", + type=str, + help="Address to bind the server to.", + default="localhost", + show_default=True, +) +@click.option( + "--bind-port", type=int, help="Port to listen on", default=45484, show_default=True ) -@click.option("--bind-port", type=int, help="Port to listen on", default=45484) @click.version_option(version=black.__version__) def main(bind_host: str, bind_port: int) -> None: logging.basicConfig(level=logging.INFO)