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
This commit is contained in:
jmcb 2023-05-31 22:29:31 +01:00 committed by GitHub
parent a4032dce64
commit a538ab7663
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -44,6 +44,9 @@
<!-- Changes to blackd -->
- The `blackd` argument parser now shows the default values for options in their help
text (#3712)
### Integrations
<!-- For example, Docker, GitHub Actions, pre-commit, editors -->

View File

@ -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)