Skip to content

Add help parameter to arguments#3473

Merged
kdeldycke merged 1 commit into
pallets:mainfrom
yurishevtsov:add-help-kwarg-to-arg-params
May 28, 2026
Merged

Add help parameter to arguments#3473
kdeldycke merged 1 commit into
pallets:mainfrom
yurishevtsov:add-help-kwarg-to-arg-params

Conversation

@yurishevtsov
Copy link
Copy Markdown
Contributor

@yurishevtsov yurishevtsov commented May 19, 2026

Adds a help parameter to click.argument() and an Arguments section on --help when argument help is set. Commands without argument help are unchanged.

Implementation follows options: Argument.get_help_record() returns the metavar and help text for the help formatter (the base Parameter class returns None, so arguments never appeared in help tables before).

Argument.to_info_dict() now includes help, matching Option, so parameter metadata stays consistent for doc tools; this is not required for CLI help output.

Deprecated arguments without explicit help show a deprecation-only row in Arguments, matching deprecated options.

fixes #2983

@yurishevtsov yurishevtsov force-pushed the add-help-kwarg-to-arg-params branch 4 times, most recently from 73e3c13 to b145f91 Compare May 19, 2026 18:55
@Rowlando13 Rowlando13 added the f:help feature: help text label May 19, 2026
@Rowlando13 Rowlando13 modified the milestones: 9.0.0, 8.5.0 May 19, 2026
@yurishevtsov yurishevtsov force-pushed the add-help-kwarg-to-arg-params branch from b145f91 to 71240f8 Compare May 19, 2026 20:02
@kdeldycke
Copy link
Copy Markdown
Collaborator

That feature exists in Cloup since v0.1.40: https://github.com/janluke/cloup/releases/tag/v0.14.0 . So additional review from @janluke would be great! :)

@kdeldycke kdeldycke requested a review from janluke May 23, 2026 12:42
@kdeldycke kdeldycke added the f:parameters feature: input parameter types label May 23, 2026
Copy link
Copy Markdown
Collaborator

@kdeldycke kdeldycke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good PR that mirrors the way help is managed on Option.

Comment thread CHANGES.rst Outdated
Comment thread src/click/core.py Outdated
Comment thread src/click/core.py Outdated
Comment thread src/click/core.py
Comment thread src/click/core.py Outdated
Comment thread docs/documentation.md Outdated
@Rowlando13
Copy link
Copy Markdown
Collaborator

@yurishevtsov After you fix up the few things listed, then should be good to go.

@yurishevtsov yurishevtsov force-pushed the add-help-kwarg-to-arg-params branch from b02456f to 21942ed Compare May 27, 2026 22:20
@yurishevtsov
Copy link
Copy Markdown
Contributor Author

Pushed 21942ed addressing all the review feedback:

  • Renamed Command.format_args --> format_arguments
  • Renamed section heading "Arguments" --> "Positional arguments"
  • Extended test coverage per review comments

Branch is rebased onto current main. Ready for another pass.

Copy link
Copy Markdown
Collaborator

@kdeldycke kdeldycke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good to be merged to main.

Closes pallets#2983

Co-authored-by: Rowlando13 <67291205+Rowlando13@users.noreply.github.com>
Co-authored-by: Kevin Deldycke <kdeldycke@users.noreply.github.com>
@kdeldycke kdeldycke force-pushed the add-help-kwarg-to-arg-params branch from 21942ed to 04cd2e4 Compare May 28, 2026 07:23
@kdeldycke kdeldycke force-pushed the add-help-kwarg-to-arg-params branch from 04cd2e4 to 684b3f5 Compare May 28, 2026 07:27
@kdeldycke
Copy link
Copy Markdown
Collaborator

Just updated the tests so this is immune to the #3509 issue, then rebase that PR on top of main and squashed the commits.

Let's merge this PR! :)

@kdeldycke kdeldycke merged commit c480210 into pallets:main May 28, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f:help feature: help text f:parameters feature: input parameter types

Projects

None yet

4 participants