From 910318dc785495eac5595b4aadba7fb99754cdfd Mon Sep 17 00:00:00 2001 From: TEC Date: Wed, 3 May 2023 00:47:39 +0800 Subject: [PATCH] Multiple banner sizes --- base/client.jl | 74 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 61 insertions(+), 13 deletions(-) diff --git a/base/client.jl b/base/client.jl index 2f1bb350ce0010..fa53d8f92fea0b 100644 --- a/base/client.jl +++ b/base/client.jl @@ -422,26 +422,74 @@ function banner(io::IO = stdout) commit = GIT_VERSION_INFO.commit_short if distance == 0 - commit_string = S"Commit {(foreground=grey):$commit} ({italic,warning:$days $unit} old master)" + commit_string = + S"""Commit {(foreground=grey):$commit} \ + ({warning:⌛ {italic:$days $unit}} old master)""" else branch = GIT_VERSION_INFO.branch - commit_string = S"{emphasis:$branch}/{(foreground=grey):$commit} (fork {italic:{warning:$distance commits}, {warning:$days $unit}})" + commit_string = + S"""{emphasis:$branch}/{(foreground=grey):$commit} \ + ({italic:{success:{bold,(italic=false):↑} $distance commits}, \ + {warning:{(italic=false):⌛} $days $unit}})""" end end commit_date = isempty(Base.GIT_VERSION_INFO.date_string) ? "" : " ($(split(Base.GIT_VERSION_INFO.date_string)[1]))" sep = StyledChar('│', :face => Face(foreground=:grey)) - - print(io, S""" - {bold,(foreground=green):_} - {bold,(foreground=blue):_} _ {bold:{(foreground=red):_}{(foreground=green):(_)}{(foreground=magenta):_}} $sep {bold:Documentation:} {(underline=bright_blue),link={https://docs.julialang.org}:https://docs.julialang.org} - {bold,(foreground=blue):(_)} | {bold:{(foreground=red):(_)} {(foreground=magenta):(_)}} $sep - _ _ _| |_ __ _ $sep Type {region,julia_help_prompt:?} for help, {region,julia_pkg_prompt:]?} for {(underline=bright_blue),link={https://pkgdocs.julialang.org/}:Pkg} help. - | | | | | | |/ _` | $sep - | | |_| | | | (_| | $sep Version {bold:$VERSION}$commit_date - _/ |\\__'_|_|_|\\__'_| $sep $commit_string - |__/ $sep - \n""") + doclink = S"{bold:Documentation:} {(underline=grey),link={https://docs.julialang.org}:https://docs.julialang.org}" + help = S"Type {region,julia_help_prompt:?} for help, {region,julia_pkg_prompt:]?} for {(underline=grey),link={https://pkgdocs.julialang.org/}:Pkg} help." + + if all(displaysize(io) .>= (25, 70)) # Full size + print(io, S""" + {bold,(foreground=green):_} + {bold,(foreground=blue):_} _ {bold:{(foreground=red):_}{(foreground=green):(_)}{(foreground=magenta):_}} $sep $doclink + {bold,(foreground=blue):(_)} | {bold:{(foreground=red):(_)} {(foreground=magenta):(_)}} $sep + _ _ _| |_ __ _ $sep $help + | | | | | | |/ _` | $sep + | | |_| | | | (_| | $sep Version {bold:$VERSION}$commit_date + _/ |\\__'_|_|_|\\__'_| $sep $commit_string + |__/ $sep + \n""") + elseif all(displaysize(io) .>= (15, 70)) # Shorter + print(io, S""" + {bold,(foreground=green):_} + {bold,(foreground=blue):_} _ {bold:{(foreground=red):_}{(foreground=green):(_)}{(foreground=magenta):_}} $sep $doclink + {bold,(foreground=blue):(_)} _ _ | |{bold:{(foreground=red):(_)} {(foreground=magenta):(_)}}_ $sep $help + | || || || || |/ _` | $sep + _/ | \\_._||_||_|\\__/_| $sep Version {bold:$VERSION}$commit_date + |__/ $sep $commit_string + \n""") + elseif all(displaysize(io) .>= (25, 45)) # Narrower + print(io, S""" + {bold,(foreground=green):_} + {bold,(foreground=blue):_} _ {bold:{(foreground=red):_}{(foreground=green):(_)}{(foreground=magenta):_}} + {bold,(foreground=blue):(_)} _ _ | |{bold:{(foreground=red):(_)} {(foreground=magenta):(_)}}_ + | || || || || |/ _` | + _/ | \\_._||_||_|\\__/_| + |__/ + + $doclink + $help + + Version {bold:$VERSION}$commit_date + $commit_string + \n""") + elseif all(displaysize(io) .>= (8, 55)) # Tiny + print(io, S""" + {bold,(foreground=blue):o} ╷{(foreground=green):∴} $sep $doclink + │╷ ╷││╭─┐ $sep Version {bold:$VERSION}$commit_date + │╰─┘╵╵╰─╰ $sep $commit_string + ╯ + """) + elseif all(displaysize(io) .>= (5, 25)) # Tinier + print(io, S""" + {bold,(foreground=blue):o} |{(foreground=green):∴} _ + ||_|||(_| + ╯{(foreground=grey):{bold:$VERSION}$commit_date} + \n""") + else # Text only + print(io, S"""{bold:{(foreground=blue):∴} {(foreground=magenta):Julia} $VERSION}$commit_date\n""") + end end global active_repl