Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/click/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2427,7 +2427,7 @@ def make_metavar(self, ctx: Context) -> str:
if metavar is None:
metavar = self.type.name.upper()

if self.nargs != 1:
if self.nargs != 1 or self.multiple:
metavar += "..."

return metavar
Expand Down
12 changes: 12 additions & 0 deletions tests/test_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,18 @@ def cmd(arg, arg2):
assert "1, 2" in result.output


def test_multiple_option_help_shows_repeated_metavar(runner):
@click.command()
@click.option("--foo", multiple=True, help="A list of foo strings.")
def cmd(foo):
pass

result = runner.invoke(cmd, ["--help"])

assert not result.exception
assert "--foo TEXT... A list of foo strings." in result.output


def test_show_default_default_map(runner):
@click.command()
@click.option("--arg", default="a", show_default=True)
Expand Down