Skip to content

Replicate change from dotnet/command-line-api#2586#49520

Merged
baronfel merged 1 commit intodotnet:mainfrom
baronfel:fix-helpbuilder-help-argument-rendering
Jun 23, 2025
Merged

Replicate change from dotnet/command-line-api#2586#49520
baronfel merged 1 commit intodotnet:mainfrom
baronfel:fix-helpbuilder-help-argument-rendering

Conversation

@baronfel
Copy link
Copy Markdown
Member

@baronfel baronfel commented Jun 21, 2025

Ensures that any zero-arity options or arguments never show an argument in help output.

This is a no-op right now (because we have no non-bool-typed zero-arity Options), but as soon as we do have one we'd hit this case.

Copilot AI review requested due to automatic review settings June 21, 2025 19:25
@baronfel baronfel requested a review from a team as a code owner June 21, 2025 19:25
@baronfel baronfel requested a review from a team June 21, 2025 19:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the help label generation logic to take an argument’s or option’s arity into account, ensuring that zero-arity symbols do not display an argument placeholder in the help output.

  • Extended GetUsageLabel to accept an ArgumentArity and skip showing a usage label when MaximumNumberOfValues is zero.
  • Updated calls to GetUsageLabel from GetArgumentUsageLabel to pass the new arity parameter.
Comments suppressed due to low confidence (1)

src/Cli/Microsoft.TemplateEngine.Cli/Help/HelpBuilder.Default.cs:67

  • Add unit tests that verify zero-arity arguments and options do not render an argument placeholder in the help output, covering both minimum and maximum arity scenarios.
                    && arity.MaximumNumberOfValues > 0 // allowing zero arguments means we don't need to show usage

@baronfel baronfel merged commit 7ee7342 into dotnet:main Jun 23, 2025
31 checks passed
@baronfel baronfel deleted the fix-helpbuilder-help-argument-rendering branch June 23, 2025 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants