From a538ab76636bbe71b7fbfeaf56fd8e61805df38f Mon Sep 17 00:00:00 2001 From: jmcb Date: Wed, 31 May 2023 22:29:31 +0100 Subject: [PATCH] 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 --- CHANGES.md | 3 +++ src/blackd/__init__.py | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) 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) -- 2.39.5