Skip to content

Fix empty description help section#2814

Closed
marko1olo wants to merge 2 commits into
dotnet:mainfrom
marko1olo:fix-empty-description-help
Closed

Fix empty description help section#2814
marko1olo wants to merge 2 commits into
dotnet:mainfrom
marko1olo:fix-empty-description-help

Conversation

@marko1olo

Copy link
Copy Markdown

Fixes #2114.

This suppresses the default help Description: section when the command description is null, empty, or whitespace. Descriptions are optional, so help output should not render an empty section.

Changes:

  • SynopsisSection() now returns false for null/empty/whitespace descriptions.
  • Adds regression coverage for null, empty, and whitespace descriptions.
  • Updates an existing help expectation that previously asserted a blank Description: section.

Validation:

  • git diff --check

Not run locally:

  • targeted dotnet test for System.CommandLine.Tests help tests.

Reason: current machine CPU stayed above the local process gate threshold, so I did not start a .NET test/build process. The change is small and covered by added/updated tests in this PR.

Comment thread src/System.CommandLine/Help/HelpBuilder.Default.cs
Comment thread src/System.CommandLine.Tests/Help/HelpBuilderTests.cs Outdated
@marko1olo
marko1olo force-pushed the fix-empty-description-help branch from 7ac030b to 7829e69 Compare June 8, 2026 18:03
@jonsequitur

Copy link
Copy Markdown
Contributor

@marko1olo This PR can be merged once you've accepted the CLA.

@marko1olo marko1olo closed this by deleting the head repository Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When Description is empty, the description section should be ommitted from help.

2 participants