Skip to content

fix: omit empty help description section#2819

Closed
YNan-varamor wants to merge 2 commits into
dotnet:mainfrom
YNan-varamor:fix/2114-empty-description-help
Closed

fix: omit empty help description section#2819
YNan-varamor wants to merge 2 commits into
dotnet:mainfrom
YNan-varamor:fix/2114-empty-description-help

Conversation

@YNan-varamor

Copy link
Copy Markdown

Summary

Omits the default help Description: section when a command description is null, empty, or whitespace.

Why

Fixes #2114. Descriptions are optional, but the default help layout always wrote a description heading. That produced an empty section such as:

Description:

Changes

  • Makes the default synopsis section return false when there is no description to render
  • Adds a regression test for null, empty, and whitespace descriptions

Validation

  • git diff --check

I attempted to run:

dotnet test src/System.CommandLine.Tests/System.CommandLine.Tests.csproj --filter "FullyQualifiedName~Synopsis_section_is_omitted_when_description_is_empty|FullyQualifiedName~Synopsis_section_properly_wraps_description"

but the local machine only has .NET SDK 10.0.203 and this repository's global.json currently requests 11.0.100-preview.4.26210.111, so the SDK could not be resolved.

AI assistance disclosure

This PR was prepared with assistance from OpenAI Codex. The change was reviewed locally and kept to a focused bug fix with a regression test.

@YNan-varamor

Copy link
Copy Markdown
Author

@dotnet-policy-service agree

@jonsequitur

Copy link
Copy Markdown
Contributor

This is a duplicate of #2814. Before submitting a PR, it's helpful to check the issue in question to see whether other PRs are linked to it.

@YNan-varamor

Copy link
Copy Markdown
Author

Closing this because it duplicates #2814. Thanks for pointing that out.

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