Skip to content

Commit 5e5e710

Browse files
Add spaces for better styling
1 parent 8c5961d commit 5e5e710

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/TerminalSystemMonitor.jl

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,13 @@ function layout(x, y)
9191
xlabel= join(
9292
[
9393
"Load average: " * join(string.(round.(Sys.loadavg(), digits=2)),' '),
94+
# Adds spaces for better styling
9495
" Uptime: $(max(Day(0), Day(datetime)-Day(1))), $(Dates.format(datetime, "HH:MM:SS"))",
9596
],
9697
'\n',
9798
),
98-
name="$(memorytot) $(memoryunit)",
99+
# Adds a space for better styling
100+
name=" $(memorytot) $(memoryunit)",
99101
maximum = Sys.total_memory() / 2^30,
100102
width = max(5, 15),
101103
),
@@ -114,13 +116,10 @@ function main(dummyargs...)
114116
while true
115117
try
116118
y = cpu_percent()
117-
x = ["id: $(i-1)" for (i, _) in enumerate(y)]
118-
(newrows, newcols) = displaysize(stdout)
119+
npad = 1+floor(Int, log10(length(y)))
120+
x = ["id: $(lpad(i-1, npad))" for (i, _) in enumerate(y)]
119121

120-
# f = barplot(x, y, title="CPU Usage", maximum=100, width=max(10, cols - 15), height=length(y))
121122
f = layout(x, y)
122-
str = string(f)
123-
newheight = 2 + length(collect(eachmatch(r"\n", str)))
124123

125124
clearlinesall()
126125

0 commit comments

Comments
 (0)