Skip to content

Commit

Permalink
move new funcs (#305)
Browse files Browse the repository at this point in the history
* move funcs

* add 1.11
  • Loading branch information
IanButterworth committed Mar 3, 2024
1 parent 55425a0 commit cb6f565
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
version:
- '1.6'
- '1'
- '1.11-nightly'
- 'nightly'
os:
- ubuntu-latest
Expand Down
32 changes: 16 additions & 16 deletions src/ProgressMeter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@ ProgressMeter

abstract type AbstractProgress end

# forward common core properties to main types
function Base.setproperty!(p::T, name::Symbol, value) where T<:AbstractProgress
if hasfield(T, name)
setfield!(p, name, value)
else
setproperty!(p.core, name, value)
end
end
function Base.getproperty(p::T, name::Symbol) where T<:AbstractProgress
if hasfield(T, name)
getfield(p, name)
else
getproperty(p.core, name)
end
end

"""
Holds the five characters that will be used to generate the progress bar.
"""
Expand Down Expand Up @@ -98,21 +114,6 @@ mutable struct Progress <: AbstractProgress
new(n, start, barlen, barglyphs, core)
end
end
# forward common core properties to main types
function Base.setproperty!(p::T, name::Symbol, value) where T<:AbstractProgress
if hasfield(T, name)
setfield!(p, name, value)
else
setproperty!(p.core, name, value)
end
end
function Base.getproperty(p::T, name::Symbol) where T<:AbstractProgress
if hasfield(T, name)
getfield(p, name)
else
getproperty(p.core, name)
end
end

"""
`prog = ProgressThresh(thresh; dt=0.1, desc="Progress: ",
Expand Down Expand Up @@ -140,7 +141,6 @@ mutable struct ProgressThresh{T<:Real} <: AbstractProgress
end
ProgressThresh(thresh::Real; kwargs...) = ProgressThresh{typeof(thresh)}(thresh; kwargs...)


"""
`prog = ProgressUnknown(; dt=0.1, desc="Progress: ",
color=:green, output=stderr)` creates a progress meter for a task
Expand Down

0 comments on commit cb6f565

Please sign in to comment.