Skip to content

cloup.Argument and click.Argument diverge now that Click 8.5.0 has argument help #210

Description

@kdeldycke

Bug description

Click 8.5.0 added a help parameter to click.Argument and a Positional arguments help section: pallets/click#3473. That is the feature Cloup has shipped since 0.14.0, and the two implementations now conflicts:

  • A plain click.argument(..., help=...) inside a Cloup command loses its description.
  • cloup.Argument drops the (DEPRECATED) label.

To Reproduce

import click
import cloup
from click.testing import CliRunner


@cloup.command()
@cloup.argument("input_path", help="Input path")
def a(**kwargs):
    """Case A: cloup.argument in a cloup command."""


@cloup.command()
@click.argument("input_path", help="Input path")
def b(**kwargs):
    """Case B: click.argument(help=...) in a cloup command."""


@cloup.command()
@cloup.argument("old_path", help="Legacy path", deprecated=True, required=False)
def c(**kwargs):
    """Case C: deprecated cloup.argument."""


@click.command()
@click.argument("old_path", help="Legacy path", deprecated=True, required=False)
def d(**kwargs):
    """Case D: deprecated click.argument."""


runner = CliRunner()
for name, cmd in [("A", a), ("B", b), ("C", c), ("D", d)]:
    print("###", name)
    print(runner.invoke(cmd, ["--help"], prog_name="example").output)
### A
Usage: example [OPTIONS] INPUT_PATH

  Case A: cloup.argument in a cloup command.

Positional arguments:
  INPUT_PATH  Input path

### B
Usage: example [OPTIONS] INPUT_PATH

  Case B: click.argument(help=...) in a cloup command.

Positional arguments:
  INPUT_PATH

### C
Usage: example [OPTIONS] [OLD_PATH!]

  Case C: deprecated cloup.argument.

Positional arguments:
  [OLD_PATH!]  Legacy path

### D
Usage: example [OPTIONS] [OLD_PATH!]

  Case D: deprecated click.argument.

Positional arguments:
  [OLD_PATH!]  Legacy path (DEPRECATED)

Expected behavior

Case B renders like case A, and case C carries the (DEPRECATED) label like case D.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions