Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
04cbf5cc
Commit
04cbf5cc
authored
Nov 19, 2023
by
Jeffrey Morgan
Browse files
progress bar styling improvements
parent
e1d70564
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
12 deletions
+6
-12
progress/bar.go
progress/bar.go
+6
-12
No files found.
progress/bar.go
View file @
04cbf5cc
...
@@ -55,7 +55,7 @@ func (b *Bar) String() string {
...
@@ -55,7 +55,7 @@ func (b *Bar) String() string {
pre
.
WriteString
(
" "
)
pre
.
WriteString
(
" "
)
}
}
fmt
.
Fprintf
(
&
pre
,
"%.
1
f%% "
,
b
.
percent
())
fmt
.
Fprintf
(
&
pre
,
"%.
0
f%% "
,
b
.
percent
())
fmt
.
Fprintf
(
&
suf
,
"(%s/%s, %s/s, %s)"
,
fmt
.
Fprintf
(
&
suf
,
"(%s/%s, %s/s, %s)"
,
format
.
HumanBytes
(
b
.
currentValue
),
format
.
HumanBytes
(
b
.
currentValue
),
...
@@ -63,26 +63,20 @@ func (b *Bar) String() string {
...
@@ -63,26 +63,20 @@ func (b *Bar) String() string {
format
.
HumanBytes
(
int64
(
b
.
rate
())),
format
.
HumanBytes
(
int64
(
b
.
rate
())),
b
.
elapsed
())
b
.
elapsed
())
mid
.
WriteString
(
"
[
"
)
mid
.
WriteString
(
"
▕
"
)
// pad 3 for last = or > and "] "
f
:=
termWidth
-
pre
.
Len
()
-
suf
.
Len
()
-
2
f
:=
termWidth
-
pre
.
Len
()
-
mid
.
Len
()
-
suf
.
Len
()
-
3
n
:=
int
(
float64
(
f
)
*
b
.
percent
()
/
100
)
n
:=
int
(
float64
(
f
)
*
b
.
percent
()
/
100
)
if
n
>
0
{
mid
.
WriteString
(
strings
.
Repeat
(
"="
,
n
))
}
if
b
.
currentValue
>=
b
.
maxValue
{
if
n
>
0
{
mid
.
WriteString
(
"="
)
mid
.
WriteString
(
strings
.
Repeat
(
"█"
,
n
))
}
else
{
mid
.
WriteString
(
">"
)
}
}
if
f
-
n
>
0
{
if
f
-
n
>
0
{
mid
.
WriteString
(
strings
.
Repeat
(
" "
,
f
-
n
))
mid
.
WriteString
(
strings
.
Repeat
(
" "
,
f
-
n
))
}
}
mid
.
WriteString
(
"
]
"
)
mid
.
WriteString
(
"
▏
"
)
return
pre
.
String
()
+
mid
.
String
()
+
suf
.
String
()
return
pre
.
String
()
+
mid
.
String
()
+
suf
.
String
()
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment