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
6452e2ec
Commit
6452e2ec
authored
Nov 21, 2023
by
Jeffrey Morgan
Browse files
fix cases where progress bar would not be fixed size
parent
aabd71ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
6 deletions
+2
-6
progress/bar.go
progress/bar.go
+2
-6
No files found.
progress/bar.go
View file @
6452e2ec
...
@@ -89,17 +89,13 @@ func (b *Bar) String() string {
...
@@ -89,17 +89,13 @@ func (b *Bar) String() string {
fmt
.
Fprintf
(
&
suf
,
")"
)
fmt
.
Fprintf
(
&
suf
,
")"
)
elapsed
:=
time
.
Since
(
b
.
started
)
var
timing
string
var
timing
string
if
stats
.
value
>
b
.
initialValue
&&
stats
.
value
<
b
.
maxValue
{
if
stats
.
value
>
b
.
initialValue
&&
stats
.
value
<
b
.
maxValue
{
timing
=
fmt
.
Sprintf
(
"[%s:%s]"
,
formatDuration
(
elaps
ed
),
formatDuration
(
stats
.
remaining
))
timing
=
fmt
.
Sprintf
(
"[%s:%s]"
,
formatDuration
(
time
.
Since
(
b
.
start
ed
)
)
,
formatDuration
(
stats
.
remaining
))
}
}
// 44 is the maximum width for the stats on the right of the progress bar
// 44 is the maximum width for the stats on the right of the progress bar
if
suf
.
Len
()
<
44
{
suf
.
WriteString
(
strings
.
Repeat
(
" "
,
44
-
suf
.
Len
()
-
len
(
timing
)))
suf
.
WriteString
(
strings
.
Repeat
(
" "
,
44
-
suf
.
Len
()
-
len
(
timing
)))
}
suf
.
WriteString
(
timing
)
suf
.
WriteString
(
timing
)
// add 3 extra spaces: 2 boundary characters and 1 space at the end
// add 3 extra spaces: 2 boundary characters and 1 space at the end
...
...
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