1
1
# https://github.com/JuliaLang/julia/blob/fae0d0ad3e5d9804533435fe81f4eaac819895af/stdlib/REPL/src/REPL.jl#L1727C1-L1795C4
2
2
3
- function banner (io:: IO = stdout ; short = false )
4
- if Base. GIT_VERSION_INFO. tagged_commit
5
- commit_string = Base. TAGGED_RELEASE_BANNER
6
- elseif isempty (Base. GIT_VERSION_INFO. commit)
7
- commit_string = " "
8
- else
9
- days = Int (floor ((ccall (:jl_clock_now , Float64, ()) - Base. GIT_VERSION_INFO. fork_master_timestamp) / (60 * 60 * 24 )))
10
- days = max (0 , days)
11
- unit = days == 1 ? " day" : " days"
12
- distance = Base. GIT_VERSION_INFO. fork_master_distance
13
- commit = Base. GIT_VERSION_INFO. commit_short
3
+ function __PythonCall_banner (io:: IO = stdout )
4
+ banner_opt = begin
5
+ opts = Base. JLOptions ()
6
+ b = opts. banner
7
+ auto = b == - 1
8
+ b == 0 || (auto && ! interactiveinput) ? :no :
9
+ b == 1 || (auto && interactiveinput) ? :yes :
10
+ :short # b == 2
11
+ end
14
12
15
- if distance == 0
16
- commit_string = " Commit $(commit) ($(days) $(unit) old master)"
17
- else
18
- branch = Base. GIT_VERSION_INFO. branch
19
- commit_string = " $(branch) /$(commit) (fork: $(distance) commits, $(days) $(unit) )"
20
- end
13
+ if banner_opt == :no
14
+ return
21
15
end
22
16
23
- commit_date = isempty (Base . GIT_VERSION_INFO . date_string) ? " " : " ( $( split (Base . GIT_VERSION_INFO . date_string)[ 1 ]) ) "
17
+ short = banner_opt == :short
24
18
25
19
if get (io, :color , false ):: Bool
26
20
c = Base. text_colors
@@ -34,8 +28,8 @@ function banner(io::IO = stdout; short = false)
34
28
35
29
if short
36
30
print (io,"""
37
- $(d3) o$(tx) | Version $(VERSION ) PythonCall: $(PythonCall . VERSION )
38
- $(d2) o$(tx) $(d4) o$(tx) | $(commit_string )
31
+ $(d3) o$(tx) | Julia $(VERSION )
32
+ $(d2) o$(tx) $(d4) o$(tx) $(c[ :bold ] * jc) o $(tx) | PythonCall $(PythonCall . VERSION )
39
33
""" )
40
34
else
41
35
print (io,""" $(d3) _$(tx)
@@ -52,8 +46,8 @@ function banner(io::IO = stdout; short = false)
52
46
else
53
47
if short
54
48
print (io,"""
55
- o | Version $(VERSION ) PythonCall: $(PythonCall . VERSION )
56
- o o | $(commit_string )
49
+ o | Julia $(VERSION )
50
+ o o o | PythonCall $(PythonCall . VERSION )
57
51
""" )
58
52
else
59
53
print (io,"""
@@ -68,4 +62,4 @@ function banner(io::IO = stdout; short = false)
68
62
""" )
69
63
end
70
64
end
71
- end
65
+ end
0 commit comments