Skip to content

fix: preserve multiline formatting in flag descriptions#71

Merged
caarlos0 merged 7 commits intomainfrom
fix-multiline-flag-descriptions
Sep 19, 2025
Merged

fix: preserve multiline formatting in flag descriptions#71
caarlos0 merged 7 commits intomainfrom
fix-multiline-flag-descriptions

Conversation

@caarlos0
Copy link
Copy Markdown
Contributor

@caarlos0 caarlos0 commented Sep 8, 2025

Summary

  • Fixes issue where multiline flag descriptions were being flattened into a single line
  • Preserves line breaks and proper indentation for continuation lines
  • Maintains backward compatibility with single-line descriptions

Test plan

  • Added comprehensive test case with golden files
  • All existing tests pass
  • Manual testing with example program shows correct multiline formatting
  • Verified default values are properly appended to the last line

💖 Generated with Crush

closes #70

caarlos0 and others added 5 commits September 8, 2025 08:52
Fixes issue where multiline flag descriptions were being flattened
into a single line, losing their formatting and readability.

Changes:
- Modified evalFlags to process multiline descriptions line by line
- Enhanced renderGroup to properly indent continuation lines
- Added test case with golden files to verify the fix
- Updated example to demonstrate multiline flag descriptions

Fixes #70

💖 Generated with Crush
Co-Authored-By: Crush <crush@charm.land>
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Use string concatenation instead of complex slice manipulation
to append default values to multiline flag descriptions.
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
@caarlos0 caarlos0 requested a review from Copilot September 8, 2025 12:15

This comment was marked as outdated.

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
@caarlos0 caarlos0 requested a review from Copilot September 8, 2025 12:41
@caarlos0 caarlos0 added the bug Something isn't working label Sep 8, 2025

This comment was marked as outdated.

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
@caarlos0 caarlos0 requested a review from Copilot September 8, 2025 17:52
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 fixes an issue where multiline flag descriptions were being flattened into single lines, now preserving proper formatting with line breaks and indentation.

  • Implements multiline flag description handling that preserves line breaks and formatting
  • Updates default value rendering to append to the last line instead of horizontal joining
  • Adds comprehensive test coverage with golden files for multiline flag descriptions

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

File Description
help.go Core logic changes to handle multiline flag descriptions with proper formatting
fang_test.go Adds test case with multiline flag descriptions to verify the fix
example/main.go Adds example multiline flag for demonstration purposes
testdata/TestSetup/with_multiline_flag_descriptions/*.golden Golden files for test validation of multiline formatting

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@caarlos0 caarlos0 merged commit c3d013d into main Sep 19, 2025
18 checks passed
@caarlos0 caarlos0 deleted the fix-multiline-flag-descriptions branch September 19, 2025 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flatterned rendering for multiline flag description

3 participants