Improve themed help and error output#382
Merged
Merged
Conversation
Contributor
Reviewer's GuideAligns themed help and error output to the left, adds spacing after EXAMPLES in help, and updates default/synthwave color schemes, with tests and changelog adjusted to assert and document the new behavior. Sequence diagram for updated styled error rendering alignmentsequenceDiagram
participant errorRenderer
participant errorOutput
participant styles
participant writer
errorRenderer->>styles: ErrorText.UnsetMarginLeft()
errorRenderer->>errorOutput: header()
errorOutput->>styles: ErrorHeader.UnsetMarginLeft().String()
errorOutput->>writer: writeln(styled_header)
errorRenderer->>errorRenderer: renderMessage(errorText)
errorRenderer->>errorRenderer: renderUsage(errorText)
errorRenderer->>errorRenderer: renderDependencyTree(depErr)
errorRenderer->>errorOutput: commandTreeTitle()
errorOutput->>styles: Title.Margin(0,0).Padding(0,0)
errorOutput->>writer: writeln(command_tree_title)
errorRenderer->>writer: writeln(strings.Repeat(" ", i+1) + joint + styles.Program.Command.Render(name))
Sequence diagram for help examples spacing after EXAMPLES titlesequenceDiagram
participant helpRenderer
participant output
participant writer
helpRenderer->>output: sectionTitle(examples)
helpRenderer->>output: blank()
output->>writer: writeln("")
loop for each example
helpRenderer->>helpRenderer: render example within width
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The new
EXAMPLES\n\nassertion inhelp_test.gois fairly brittle to formatting changes (e.g., different line endings or future spacing tweaks); consider asserting the position of a blank line relative to theEXAMPLESheading instead of matching the exact substring. - The error alignment tests in
TestErrorHandlerRemovesErrorTextLeftMarginrely on specific substrings/whitespace patterns; you might make them more resilient by splitting output into lines and asserting indentation per-line rather than using multipleContainschecks with embedded spaces.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new `EXAMPLES\n\n` assertion in `help_test.go` is fairly brittle to formatting changes (e.g., different line endings or future spacing tweaks); consider asserting the position of a blank line relative to the `EXAMPLES` heading instead of matching the exact substring.
- The error alignment tests in `TestErrorHandlerRemovesErrorTextLeftMargin` rely on specific substrings/whitespace patterns; you might make them more resilient by splitting output into lines and asserting indentation per-line rather than using multiple `Contains` checks with embedded spaces.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
318de78 to
ba33c77
Compare
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
ERRORbadge.EXAMPLEShelp title and rendered examples.Why
The themed terminal output had inconsistent horizontal spacing: unknown-command errors, usage hints, and dependency trees were indented farther right than desired. The
EXAMPLESheading also ran directly into the first example, unlike theUSAGEsection.Impact
Users get more compact, consistently aligned styled help and error output. The
ERRORbadge keeps its left and right padding inside the colored background.Validation
go run ./cmd/lets help test-batsshows a blank line afterEXAMPLES./private/tmp/lets-indent-test tttshows left-aligned styled errors with paddedERRORbadge.go test ./internal/cmdpasses.go test ./...currently fails ininternal/theme:TestColorSchemeByNamestill expects the old default title colorAsh, while this branch returns#0BF4F1from the theme color update commit.Summary by Sourcery
Improve alignment and theming of styled help and error output for CLI commands.
Bug Fixes:
Enhancements:
Documentation: