From 097d0723cada5f7c837b09889397aa67bab8c58b Mon Sep 17 00:00:00 2001 From: Maurice Makaay Date: Mon, 28 Jul 2025 20:04:03 +0200 Subject: [PATCH 1/2] Fix the output for no_args_is_help=True MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since typer 0.16.0, running a CLI with the no_args_is_help feature enabled displays an error block, e.g. for my application: Usage: myapp [OPTIONS] COMMAND [ARGS]... This is the CLI for my app ╭─ Options ─────────────────────────────────────────────────────────╮ │ --verbose -v Use multiple times for more verbosity. │ │ --help Show this message and exit. │ ╰───────────────────────────────────────────────────────────────────╯ ╭─ Commands ────────────────────────────────────────────────────────╮ │ version Show application version. │ │ run Start the application. │ ╰───────────────────────────────────────────────────────────────────╯ Usage: authsync [OPTIONS] COMMAND [ARGS]... Try 'authsync --help' for help. ╭─ Error ───────────────────────────────────────────────────────────╮ │ │ ╰───────────────────────────────────────────────────────────────────╯ The patch from the PR suppresses the duplicate Usage: info and the Error output block, in case the processed exception is a NoArgsIsHelperror. --- typer/core.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/typer/core.py b/typer/core.py index f6c4f72e8a..f8455d6b2c 100644 --- a/typer/core.py +++ b/typer/core.py @@ -20,6 +20,7 @@ import click import click.core +from click.exceptions import NoArgsIsHelpError import click.formatting import click.parser import click.shell_completion @@ -208,6 +209,8 @@ def _main( raise click.Abort() from e except KeyboardInterrupt as e: raise click.exceptions.Exit(130) from e + except NoArgsIsHelpError: + click.echo() except click.ClickException as e: if not standalone_mode: raise From eb25c00c3940051ff0af782858ab4e02f8be1957 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 28 Jul 2025 18:25:43 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=8E=A8=20[pre-commit.ci]=20Auto=20for?= =?UTF-8?q?mat=20from=20pre-commit.com=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typer/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typer/core.py b/typer/core.py index f8455d6b2c..40080db74f 100644 --- a/typer/core.py +++ b/typer/core.py @@ -20,12 +20,12 @@ import click import click.core -from click.exceptions import NoArgsIsHelpError import click.formatting import click.parser import click.shell_completion import click.types import click.utils +from click.exceptions import NoArgsIsHelpError from ._typing import Literal