-
Notifications
You must be signed in to change notification settings - Fork 93
chore: simplify the colorize template function #777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in 8000 to your account
Conversation
WalkthroughThe pull request introduces modifications to the Changes
Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #777 +/- ##
==========================================
- Coverage 69.96% 69.95% -0.01%
==========================================
Files 213 213
Lines 18177 18172 -5
==========================================
- Hits 12718 12713 -5
Misses 4762 4762
Partials 697 697 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
console/cli_helper.go
(1 hunks)console/cli_helper_test.go
(1 hunks)
🔇 Additional comments (3)
console/cli_helper_test.go (1)
146-146
: LGTM: Usage string updated to use style tags
The test has been correctly updated to use the new style tag format <fg=blue>int</> flag
instead of the template format.
Let's verify the test coverage:
✅ Verification successful
Test coverage for style tags is complete and consistent
The verification confirms that:
- No old template format (
{{...}}
) remains in the test file - Only one style tag instance exists and it's using the new format correctly
- No other color-related test cases were found that would need updating
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify that all test cases cover the new style tag format
rg -A 2 '<fg=.*?>' console/cli_helper_test.go
Length of output: 95
Script:
#!/bin/bash
# Let's check if there are any other test cases still using the old template format
rg -A 2 '{{.*?blue.*?}}' console/cli_helper_test.go
# Also check for any other color templates to ensure complete coverage
rg -A 2 '{{.*?(red|green|yellow|blue|magenta|cyan|white|black).*?}}' console/cli_helper_test.go
Length of output: 375
Script:
#!/bin/bash
# Let's check if there are any other test cases still using the old template format
# Escaping the curly braces properly this time
rg -A 2 '\{\{.*blue.*\}\}' console/cli_helper_test.go
# Also check for any other color templates to ensure complete coverage
rg -A 2 '\{\{.*(red|green|yellow|blue|magenta|cyan|white|black).*\}\}' console/cli_helper_test.go
# Let's also check for any other style tags to ensure consistency
rg -A 2 '<fg=.*?>' console/cli_helper_test.go
Length of output: 251
console/cli_helper.go (2)
181-183
: Great documentation improvement
Clear documentation with a helpful link to the style tag reference.
181-185
: Consider architectural consistency with templates
While moving to style tags is a good direction, the codebase still heavily relies on template-based color functions (colorsFuncMap
). Consider:
- Whether both styling approaches should coexist
- If a complete migration to style tags would be cleaner
- How this affects template rendering performance
Let's analyze the t 8000 emplate usage:
Please solve the conflict |
Done! |
📑 Description
Replaced template parsing with style tag support for inline text styling.
For more details on style tags, visit: https://gookit.github.io/color/#/?id=tag-attributes
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
colorize
function to clarify its functionality and support for style tags.✅ Checks