-
-
Notifications
You must be signed in to change notification settings - Fork 13
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 to your account
init(coloring): add same coloring to all #38
init(coloring): add same coloring to all #38
Conversation
👇 Click on the image for a new way to code review
Legend |
Codecov ReportBase: 100.00% // Head: 79.68% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #38 +/- ##
============================================
- Coverage 100.00% 79.68% -20.32%
============================================
Files 1 2 +1
Lines 36 64 +28
============================================
+ Hits 36 51 +15
- Misses 0 11 +11
- Partials 0 2 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
this is a bit tangled up, and currently just shows a big blob of color, this is why I wanted a designer to look at it now :) |
related to #34 |
design rought outline: |
cmd/root.go
Outdated
if !isStylePopulated { | ||
isStylePopulated = true | ||
baseRootStyle = lipgloss.NewStyle().Width(width) | ||
} |
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.
I don't think we need to protect this bit with a bool. isStylePopulated
isn't actually set elsewhere.
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.
but the func is happening multiple times, I can set it each time if it's clearer
view.go
Outdated
) | ||
|
||
var ( | ||
resultStyle, nameStyle, summaryStyle lipgloss.Style |
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.
resultStyle
doesn't appear to be consumed anywhere, might be worth removing it.
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.
resultStyle was the base style before using the style I got from the caller, so removed
view.go
Outdated
|
||
func PrintResultsWithStyle(results References, rootStyle lipgloss.Style) { | ||
// doing the population in a point where the width should not change anymore | ||
if !areStylesPopulated { |
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.
Not sure we need this bool either.
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.
this is a different func, thus styles need to be set here aswell
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.
so it is required
view.go
Outdated
func renderStyles(baseStyle lipgloss.Style) { | ||
resultStyle = baseStyle.Copy() | ||
nameStyle = baseStyle.Copy(). | ||
Foreground(lipgloss.Color("86")). | ||
Bold(true). | ||
Underline(true) | ||
|
||
summaryStyle = baseStyle.Copy() | ||
r, err := glamour.NewTermRenderer( | ||
// detect background color and pick either the default dark or light theme | ||
glamour.WithAutoStyle(), | ||
// wrap output at specific width (default is 80) | ||
glamour.WithWordWrap(baseStyle.GetWidth()), | ||
) | ||
if err != nil { | ||
// hoping this doesn't happen as most commands here suceed without issue | ||
panic(err) | ||
} | ||
descriptionStyle = r | ||
} |
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.
I like how this function sets the style but not keen on the use of global scope variables. Maybe return the different styles so that can be consumed in PrintResultsWithSyle
?
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.
yeah, I can return a style but this means I need to decide each time which style is what I want.
I'll do that and we'll see how it looks
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.
tried that and it makes me inject the styles all the way down
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.
@dnnrly do you think it's ok to close it? if so feel free to do so
I don't suppose you've been able to run the unit and acceptance tests? They obviously run as part of the checks for this PR but I've not been able to get them to work locally. Have you been able to get them to work? Linting too.
|
I just ran the normal tests, sry :( I'll get them to work too |
@dnnrly then why did the CI pass then? |
I'm really not sure why. I spent some time last night trying to figure out why and didn't get anywhere. Mind if I push a couple of changed to see if we can get to the bottom of it? |
sure! |
please do let me know when you have fixed the CI issue |
I think I've fixed the issue but you'll have to rebase your branch on top of master. |
of course, no worries |
from this base I can trickle the coloring into anywhere I need
for pretty printing the description
to make the description colorful
Co-authored-by: Pascal Dennerly <[email protected]>
054c833
to
52b1e7b
Compare
- remove the if statement
so now there is another issue, not sure exactly how to move forward from it. PS now also the |
I wonder if it's something to do with the formatting markup in the terminal. I'll take a look. |
- Removed a test that just asserted that the formatting library works as specified.
- This is checking that the formatter is formatting again so the test clause should be removed.
I think I sorted the test failures (I may have cheated a little). Only thing now is to make the test coverage adequate. Maybe make |
yeah, that is the right way of doing things and I didn't want to bubble it up. |
and thanks for the help! |
This is more than good enough. Anything important can be dealt with in other PRs. Thanks for your help in this!!! I'm going to be away from the computer for a little bit so I'm just merging as-is. |
from this base I can trickle the coloring into anywhere I need