Skip to content

Commit a68bb6f

Browse files
committed
Multiple banner sizes
1 parent 1f1607d commit a68bb6f

File tree

1 file changed

+61
-13
lines changed

1 file changed

+61
-13
lines changed

base/client.jl

Lines changed: 61 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -422,26 +422,74 @@ function banner(io::IO = stdout)
422422
commit = GIT_VERSION_INFO.commit_short
423423

424424
if distance == 0
425-
commit_string = S"Commit {(foreground=grey):$commit} ({italic,warning:$days $unit} old master)"
425+
commit_string =
426+
S"""Commit {(foreground=grey):$commit} \
427+
({warning:⌛ {italic:$days $unit}} old master)"""
426428
else
427429
branch = GIT_VERSION_INFO.branch
428-
commit_string = S"{emphasis:$branch}/{(foreground=grey):$commit} (fork {italic:{warning:$distance commits}, {warning:$days $unit}})"
430+
commit_string =
431+
S"""{emphasis:$branch}/{(foreground=grey):$commit} \
432+
({italic:{success:{bold,(italic=false):↑} $distance commits}, \
433+
{warning:{(italic=false):⌛} $days $unit}})"""
429434
end
430435
end
431436

432437
commit_date = isempty(Base.GIT_VERSION_INFO.date_string) ? "" : " ($(split(Base.GIT_VERSION_INFO.date_string)[1]))"
433438
sep = StyledChar('', :face => Face(foreground=:grey))
434-
435-
print(io, S"""
436-
{bold,(foreground=green):_}
437-
{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}
438-
{bold,(foreground=blue):(_)} | {bold:{(foreground=red):(_)} {(foreground=magenta):(_)}} $sep
439-
_ _ _| |_ __ _ $sep Type {region,julia_help_prompt:?} for help, {region,julia_pkg_prompt:]?} for {(underline=bright_blue),link={https://pkgdocs.julialang.org/}:Pkg} help.
440-
| | | | | | |/ _` | $sep
441-
| | |_| | | | (_| | $sep Version {bold:$VERSION}$commit_date
442-
_/ |\\__'_|_|_|\\__'_| $sep $commit_string
443-
|__/ $sep
444-
\n""")
439+
doclink = S"{bold:Documentation:} {(underline=grey),link={https://docs.julialang.org}:https://docs.julialang.org}"
440+
help = S"Type {region,julia_help_prompt:?} for help, {region,julia_pkg_prompt:]?} for {(underline=grey),link={https://pkgdocs.julialang.org/}:Pkg} help."
441+
442+
if all(displaysize(io) .>= (25, 70)) # Full size
443+
print(io, S"""
444+
{bold,(foreground=green):_}
445+
{bold,(foreground=blue):_} _ {bold:{(foreground=red):_}{(foreground=green):(_)}{(foreground=magenta):_}} $sep $doclink
446+
{bold,(foreground=blue):(_)} | {bold:{(foreground=red):(_)} {(foreground=magenta):(_)}} $sep
447+
_ _ _| |_ __ _ $sep $help
448+
| | | | | | |/ _` | $sep
449+
| | |_| | | | (_| | $sep Version {bold:$VERSION}$commit_date
450+
_/ |\\__'_|_|_|\\__'_| $sep $commit_string
451+
|__/ $sep
452+
\n""")
453+
elseif all(displaysize(io) .>= (15, 70)) # Shorter
454+
print(io, S"""
455+
{bold,(foreground=green):_}
456+
{bold,(foreground=blue):_} _ {bold:{(foreground=red):_}{(foreground=green):(_)}{(foreground=magenta):_}} $sep $doclink
457+
{bold,(foreground=blue):(_)} _ _ | |{bold:{(foreground=red):(_)} {(foreground=magenta):(_)}}_ $sep $help
458+
| || || || || |/ _` | $sep
459+
_/ | \\_._||_||_|\\__/_| $sep Version {bold:$VERSION}$commit_date
460+
|__/ $sep $commit_string
461+
\n""")
462+
elseif all(displaysize(io) .>= (25, 45)) # Narrower
463+
print(io, S"""
464+
{bold,(foreground=green):_}
465+
{bold,(foreground=blue):_} _ {bold:{(foreground=red):_}{(foreground=green):(_)}{(foreground=magenta):_}}
466+
{bold,(foreground=blue):(_)} _ _ | |{bold:{(foreground=red):(_)} {(foreground=magenta):(_)}}_
467+
| || || || || |/ _` |
468+
_/ | \\_._||_||_|\\__/_|
469+
|__/
470+
471+
$doclink
472+
$help
473+
474+
Version {bold:$VERSION}$commit_date
475+
$commit_string
476+
\n""")
477+
elseif all(displaysize(io) .>= (8, 55)) # Tiny
478+
print(io, S"""
479+
{bold,(foreground=blue):o} ╷{(foreground=green):∴} $sep $doclink
480+
│╷ ╷││╭─┐ $sep Version {bold:$VERSION}$commit_date
481+
│╰─┘╵╵╰─╰ $sep $commit_string
482+
483+
""")
484+
elseif all(displaysize(io) .>= (5, 25)) # Tinier
485+
print(io, S"""
486+
{bold,(foreground=blue):o} |{(foreground=green):∴} _
487+
||_|||(_|
488+
╯{(foreground=grey):{bold:$VERSION}$commit_date}
489+
\n""")
490+
else # Text only
491+
print(io, S"""{bold:{(foreground=blue):∴} {(foreground=magenta):Julia} $VERSION}$commit_date\n""")
492+
end
445493
end
446494

447495
global active_repl

0 commit comments

Comments
 (0)