Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There's always tomorrow() #21

Merged
merged 4 commits into from
Jul 22, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 30 additions & 9 deletions src/schedule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ function today(;
return today(Val(output); now, track, terminal_links)
end

function today(::Val{:terminal}; now, track, terminal_links)
function today(::Val{:terminal}; now, track, terminal_links, highlighting=true)
tracks, tables, highlighters = _get_today_tables(; now, track, terminal_links)
isnothing(tables) && return nothing

Expand All @@ -267,6 +267,9 @@ function today(::Val{:terminal}; now, track, terminal_links)
border_crayon = crayon"dark_gray"
h_times = Highlighter((data, i, j) -> j == 1, crayon"white bold")

println()
println(TimeZones.Date(now))
IanButterworth marked this conversation as resolved.
Show resolved Hide resolved

for j in eachindex(tracks)
track = tracks[j]
data = tables[j]
Expand All @@ -286,11 +289,13 @@ function today(::Val{:terminal}; now, track, terminal_links)
end

println()
printstyled("Currently running talks are highlighted in ")
printstyled("yellow"; color=:yellow)
printstyled(".")
println()
println()
if highlighting
printstyled("Currently running talks are highlighted in ")
printstyled("yellow"; color=:yellow)
printstyled(".")
println()
println()
end
print(abbrev(Talk), " = Talk, ")
print(abbrev(LightningTalk), " = Lightning Talk, ")
print(abbrev(SponsorTalk), " = Sponsor Talk, ")
Expand All @@ -305,7 +310,7 @@ function today(::Val{:terminal}; now, track, terminal_links)
return nothing
end

function today(::Val{:text}; now, track, terminal_links)
function today(::Val{:text}; now, track, terminal_links, highlighting=true)
tracks, tables, highlighters = _get_today_tables(; now, track, terminal_links)
isnothing(tables) && return nothing

Expand Down Expand Up @@ -334,9 +339,16 @@ function today(::Val{:text}; now, track, terminal_links)
push!(strings, str)
end

legend = """
Currently running talks are highlighted in yellow (or not cause WIP).
legend = if highlighting
"""
Currently running talks are highlighted in yellow (or not cause WIP).

"""
else
""
end

legend *= """
$(JuliaCon.abbrev(JuliaCon.Talk)) = Talk, $(JuliaCon.abbrev(JuliaCon.LightningTalk)) = Lightning Talk, $(JuliaCon.abbrev(JuliaCon.SponsorTalk)) = Sponsor Talk, $(JuliaCon.abbrev(JuliaCon.Keynote)) = Keynote,
$(JuliaCon.abbrev(JuliaCon.Workshop)) = Workshop, $(JuliaCon.abbrev(JuliaCon.Minisymposium)) = Minisymposium, $(JuliaCon.abbrev(JuliaCon.BoF)) = Birds of Feather,
$(JuliaCon.abbrev(JuliaCon.Experience)) = Experience, $(JuliaCon.abbrev(JuliaCon.VirtualPoster)) = Virtual Poster
Expand All @@ -346,3 +358,12 @@ function today(::Val{:text}; now, track, terminal_links)
push!(strings, legend)
return strings
end

function tomorrow(;
now=default_now(),
track=nothing,
terminal_links=TERMINAL_LINKS,
output=:terminal, # can take the :text value to output a Vector{String}
)
return today(Val(output); now = now + Dates.Day(1), track, terminal_links, highlighting = false)
IanButterworth marked this conversation as resolved.
Show resolved Hide resolved
end
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ using TimeZones
@test isnothing(JuliaCon.today())
@test isnothing(JuliaCon.today(track="BoF"))
@test isnothing(JuliaCon.today(terminal_links=true))
@test isnothing(JuliaCon.tomorrow())
@test isnothing(JuliaCon.tomorrow())
carstenbauer marked this conversation as resolved.
Show resolved Hide resolved

# output to text (Vector{Sting})
println("\n")
Expand Down