Fix verdi status message when no daemon is available#7304
Conversation
It's not neccessary to print the same URL to the docs twice in a row.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7304 +/- ##
==========================================
+ Coverage 79.86% 79.87% +0.01%
==========================================
Files 566 566
Lines 43936 43941 +5
==========================================
+ Hits 35084 35092 +8
+ Misses 8852 8849 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Thank @danielhollas
I also encountered this before.
Maybe we take this opportunity and try to make the link more visible, perhaps with breaking the line.
Right now, one has to scroll too much to the right to see the link.
here:
f'No broker defined for this profile: certain functionality not available. See {URL_NO_BROKER}',
There was a problem hiding this comment.
I just read you also suggested that in your own comment.
I think, it's pretty straightforward. Just modify print_status:
- echo.echo(f"{service + ':':12s} {msg}")
+ lines = str(msg).split('\n')
+ indent = ' ' * (len(f" {symbol['string']} ") + len(f"{service + ':':12s} "))
+ echo.echo(f"{service + ':':12s} {lines[0]}")
+ for line in lines[1:]:
+ echo.echo(f"{indent}{line}")
|
Here's how it looks now: At first I also thought of automatically splitting the string on |
| symbol = STATUS_SYMBOLS[status] | ||
| echo.echo(f" {symbol['string']} ", fg=symbol['color'], nl=False) | ||
| echo.echo(f"{service + ':':12s} {msg}") | ||
| echo.echo(f"{service + ':':12s} ", nl=False) |
There was a problem hiding this comment.
| echo.echo(f"{service + ':':12s} ", nl=False) | |
| echo.echo(f"{service + ':':12s}", nl=False) |
Either this, or increment 15 to 16.
space+symbol+space+(the space I removed) = 4
+12=16
There was a problem hiding this comment.
I think the current code is correct (and aligns in my terminal) since I also have an extra space in the echo in the for loop.
There was a problem hiding this comment.
Sorry, but I don't understand, how?
khsrali
left a comment
There was a problem hiding this comment.
All good, @danielhollas
I left one minor comment. I think there was a mistake counting the paddings.
| lines = msg.split('\n') | ||
| echo.echo(lines[0]) | ||
| for line in lines[1:]: | ||
| echo.echo(f"{'':15s} {line}") |
There was a problem hiding this comment.
@khsrali the number of leading spaces in this print is 15+1=16
IMO It's not neccessary to print the same URL to the docs twice in a row (both for broker and daemon).
(also the string was missing the f-string prefix so the URL was not printed correctly).
Here's how it looks now for a presto profile.
(I think it would be nicer to print the URL on a new line, but that would require bit more work due to the way things are printed currently)