@@ -1700,21 +1700,11 @@ function ends_with_semicolon(code)
17001700 return semi
17011701end
17021702
1703- """
1704- banner(io::IO = stdout, preferred::Symbol = :full)
1705-
1706- Print the "Julia" informative banner to `io`, using the `preferred` variant
1707- if reasonable and known.
1708-
1709- !!! warning
1710- The particular banner selected by `preferred` is liable to being changed
1711- without warning. The current variants are: `:tiny`, `:short`, `:narrow`, and `:full`.
1712- """
1713- function banner (io:: IO = stdout , preferred:: Symbol = :full )
1714- commit_string = if Base. GIT_VERSION_INFO. tagged_commit
1715- Base. AnnotatedString (TAGGED_RELEASE_BANNER, :face => :shadow )
1703+ function banner (io:: IO = stdout ; short = false )
1704+ if Base. GIT_VERSION_INFO. tagged_commit
1705+ commit_string = Base. TAGGED_RELEASE_BANNER
17161706 elseif isempty (Base. GIT_VERSION_INFO. commit)
1717- styled ""
1707+ commit_string = " "
17181708 else
17191709 days = Int (floor ((ccall (:jl_clock_now , Float64, ()) - Base. GIT_VERSION_INFO. fork_master_timestamp) / (60 * 60 * 24 )))
17201710 days = max (0 , days)
@@ -1723,65 +1713,60 @@ function banner(io::IO = stdout, preferred::Symbol = :full)
17231713 commit = Base. GIT_VERSION_INFO. commit_short
17241714
17251715 if distance == 0
1726- styled """ Commit {grey:$commit} \
1727- ({warning:⌛ {italic:$days $unit}} old master)"""
1716+ commit_string = " Commit $(commit) ($(days) $(unit) old master)"
17281717 else
17291718 branch = Base. GIT_VERSION_INFO. branch
1730- styled """ {emphasis:$branch}/{grey:$commit} \
1731- ({italic:{success:{bold,(slant=normal):↑} $distance commits}, \
1732- {warning:{(slant=normal):⌛} $days $unit}})"""
1719+ commit_string = " $(branch) /$(commit) (fork: $(distance) commits, $(days) $(unit) )"
17331720 end
17341721 end
17351722
1736- commit_date = isempty (Base. GIT_VERSION_INFO. date_string) ? " " : styled " {light:($(split(Base.GIT_VERSION_INFO.date_string)[1]))}"
1737- doclink = styled " {bold:Documentation:} {(underline=grey),link={https://docs.julialang.org}:https://docs.julialang.org}"
1738- help = styled " Type {repl_prompt_help:?} for help, {repl_prompt_pkg:]?} for {(underline=grey),link={https://pkgdocs.julialang.org/}:Pkg} help."
1739-
1740- sizenames = (:tiny , :short , :narrow , :full )
1741- maxsize = something (findfirst (== (preferred), sizenames), length (sizenames))
1742- size = min (if all (displaysize (io) .>= (8 , 70 )); 4 # Full size
1743- elseif all (displaysize (io) .>= (8 , 45 )); 3 # Narrower
1744- elseif all (displaysize (io) .>= (3 , 50 )); 2 # Tiny
1745- else 1 end ,
1746- max (0 , maxsize))
1747-
1748- if size == 4 # Full size
1749- print (io, styled """
1750- {bold,green:_}
1751- {bold,blue:_} _ {bold:{red:_}{green:(_)}{magenta:_}} {shadow:│} $doclink
1752- {bold,blue:(_)} | {bold:{red:(_)} {magenta:(_)}} {shadow:│}
1753- _ _ _| |_ __ _ {shadow:│} $help
1754- | | | | | | |/ _` | {shadow:│}
1755- | | |_| | | | (_| | {shadow:│} Version {bold:$VERSION}$commit_date
1756- _/ |\\ __'_|_|_|\\ __'_| {shadow:│} $commit_string
1757- |__/ {shadow:│}
1758- \n """ )
1759- elseif size == 3 # Rotated
1760- print (io, styled """
1761- {bold,green:_}
1762- {bold,blue:_} _ {bold:{red:_}{green:(_)}{magenta:_}}
1763- {bold,blue:(_)} | {bold:{red:(_)} {magenta:(_)}}
1764- _ _ _| |_ __ _
1765- | | | | | | |/ _` |
1766- | | |_| | | | (_| |
1767- _/ |\\ __'_|_|_|\\ __'_|
1768- |__/
1769-
1770- $doclink
1771- $help
1772-
1773- Version {bold:$VERSION}$commit_date
1774- $commit_string
1775- \n """ )
1776- elseif size == 2 # Tiny
1777- print (io, styled """
1778- {bold,green:o} {shadow:│} Version {bold:$VERSION}$commit_date
1779- {bold:{red:o} {magenta:o}} {shadow:│} $commit_string
1780- """ , ifelse (displaysize (io) > (12 , 0 ), " \n " , " " ))
1781- elseif size == 1 && Base. GIT_VERSION_INFO. tagged_commit # Text only
1782- print (io, styled """ {bold:{blue:∴} {magenta:Julia} $VERSION}$commit_date\n """ )
1783- elseif size == 1 # Text only
1784- print (io, styled """ {bold:{blue:∴} {magenta:Julia} $VERSION}$commit_date $commit_string\n """ )
1723+ commit_date = isempty (Base. GIT_VERSION_INFO. date_string) ? " " : " ($(split (Base. GIT_VERSION_INFO. date_string)[1 ]) )"
1724+
1725+ if get (io, :color , false ):: Bool
1726+ c = Base. text_colors
1727+ tx = c[:normal ] # text
1728+ jl = c[:normal ] # julia
1729+ d1 = c[:bold ] * c[:blue ] # first dot
1730+ d2 = c[:bold ] * c[:red ] # second dot
1731+ d3 = c[:bold ] * c[:green ] # third dot
1732+ d4 = c[:bold ] * c[:magenta ] # fourth dot
1733+
1734+ if short
1735+ print (io,"""
1736+ $(d3) o$(tx) | Version $(VERSION )$(commit_date)
1737+ $(d2) o$(tx) $(d4) o$(tx) | $(commit_string)
1738+ """ )
1739+ else
1740+ print (io,""" $(d3) _$(tx)
1741+ $(d1) _$(tx) $(jl) _$(tx) $(d2) _$(d3) (_)$(d4) _$(tx) | Documentation: https://docs.julialang.org
1742+ $(d1) (_)$(jl) | $(d2) (_)$(tx) $(d4) (_)$(tx) |
1743+ $(jl) _ _ _| |_ __ _$(tx) | Type \" ?\" for help, \" ]?\" for Pkg help.
1744+ $(jl) | | | | | | |/ _` |$(tx) |
1745+ $(jl) | | |_| | | | (_| |$(tx) | Version $(VERSION )$(commit_date)
1746+ $(jl) _/ |\\ __'_|_|_|\\ __'_|$(tx) | $(commit_string)
1747+ $(jl) |__/$(tx) |
1748+
1749+ """ )
1750+ end
1751+ else
1752+ if short
1753+ print (io,"""
1754+ o | Version $(VERSION )$(commit_date)
1755+ o o | $(commit_string)
1756+ """ )
1757+ else
1758+ print (io,"""
1759+ _
1760+ _ _ _(_)_ | Documentation: https://docs.julialang.org
1761+ (_) | (_) (_) |
1762+ _ _ _| |_ __ _ | Type \" ?\" for help, \" ]?\" for Pkg help.
1763+ | | | | | | |/ _` | |
1764+ | | |_| | | | (_| | | Version $(VERSION )$(commit_date)
1765+ _/ |\\ __'_|_|_|\\ __'_| | $(commit_string)
1766+ |__/ |
1767+
1768+ """ )
1769+ end
17851770 end
17861771end
17871772
0 commit comments