Skip to content

Exit code changed for command showing help message when arguments are not provided #2909

@mscheltienne

Description

@mscheltienne

Defining a simple entry-point group:

from __future__ import annotations

import click

from .sys_info import run as sys_info


@click.group()
def run() -> None:
    """Main package entry-point."""  # noqa: D401


run.add_command(sys_info)

And executing the corresponding command without an arguments shows the help message, e.g.

$ my_click_cmd
Usage: my_click_cmd [OPTIONS] COMMAND [ARGS]...

  Main package entry-point.

Options:
  --help  Show this message and exit.

Commands:
  sys-info  Run sys_info() command.

But now returns exit code 2 instead of 0 as in click<8.2.0. $ my_click_cmd --help, providing explicitly the --help option returns the same message with exit code 0.

Is this an intended backward incompatible change (undocumented in the changelog), or an introduced bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions