Skip to content

Commit 2d5d67e

Browse files
authored
fix extra_info on progress bar (#257)
1 parent 71c4449 commit 2d5d67e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/progress.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ mutable struct ProgressBar
270270
paused::Bool
271271
task::Union{Task,Nothing}
272272
renderstatus::Any
273-
extra_info::Union{Dict{String,<:Any},Nothing}
273+
extra_info::Dict{String,<:Any}
274274
end
275275

276276
"""
@@ -286,7 +286,7 @@ end
286286
RGBColor("(.05, 1, .05)"),
287287
],
288288
refresh_rate::Int = 60, # FPS of rendering
289-
extra_info::Union{Dict{String,<:Any},Nothing} = nothing,
289+
extra_info::Dict{String,<:Any} = Dict{String,Any}(),
290290
)
291291
292292
Create a ProgressBar instance.
@@ -299,7 +299,7 @@ function ProgressBar(;
299299
transient::Bool = false,
300300
colors::Union{String,Vector{RGBColor}} = [RGBColor("(1, .05, .05)"), RGBColor("(.05, .05, 1)"), RGBColor("(.05, 1, .05)")],
301301
refresh_rate::Int = 60, # FPS of rendering
302-
extra_info::Union{Dict{String,<:Any},Nothing} = nothing,
302+
extra_info::Dict{String,<:Any} = Dict{String,Any}(),
303303
)
304304
columns = columns isa Symbol ? get_columns(columns) : columns
305305

@@ -530,7 +530,7 @@ function render(pbar::ProgressBar)
530530
end
531531

532532
# render the extra information
533-
if !isnothing(pbar.extra_info)
533+
if !isempty(pbar.extra_info)
534534
max_len = maximum(length.(keys(pbar.extra_info)))
535535
for (k, v) in pbar.extra_info
536536
write(iob, "\n" * k * " "^(max_len - length(k)) * " : " * string(v))

0 commit comments

Comments
 (0)