fix: preserve multiline formatting in flag descriptions#71
Merged
Conversation
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>
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>
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
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.
ccoVeille
reviewed
Sep 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test plan
💖 Generated with Crush
closes #70