Browse Source

make --version printing compatible with juliac (#103)

pull/104/head
Fredrik Ekre 1 year ago committed by GitHub
parent
commit
829dc34225
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 19
      src/juliac.jl
  2. 8
      src/main.jl

19
src/juliac.jl

@ -70,6 +70,25 @@ function sprint_showerror_juliac(err::Exception) @@ -70,6 +70,25 @@ function sprint_showerror_juliac(err::Exception)
end
end
# juliac-compatible print(::IO, ::VersionNumber) with explicitly `@inline`d `join` calls...
function print_vnum_juliac(io::IO, v::VersionNumber)
v == typemax(VersionNumber) && return print(io, "")
print(io, v.major)
print(io, '.')
print(io, v.minor)
print(io, '.')
print(io, v.patch)
if !isempty(v.prerelease)
print(io, '-')
@inline join(io, v.prerelease, '.')
end
if !isempty(v.build)
print(io, '+')
@inline join(io, v.build, '.')
end
return
end
# juliac-compatible `Base.tempdir` and `Base.mktempdir` without logging and deferred cleanup
function tempdir_juliac()
buf = Base.StringVector(Base.Filesystem.AVG_PATH - 1)

8
src/main.jl

@ -16,6 +16,7 @@ const juliac = @load_preference("juliac", false) @@ -16,6 +16,7 @@ const juliac = @load_preference("juliac", false)
const printstyled = printstyled_juliac
const mktempdir = mktempdir_juliac
const sprint_showerror = sprint_showerror_juliac
const print_vnum = print_vnum_juliac
else
# const stdin = Base.stdin
# const stdout = Base.stdout
@ -24,6 +25,7 @@ else @@ -24,6 +25,7 @@ else
const printstyled = Base.printstyled
const mktempdir = Base.mktempdir
sprint_showerror(err::Exception) = sprint(showerror, err)
const print_vnum = Base.print
end
supports_color(io) = get(io, :color, false)
@ -149,7 +151,11 @@ function print_help() @@ -149,7 +151,11 @@ function print_help()
end
function print_version()
println(stdout, "runic version $(RUNIC_VERSION), julia version $(VERSION)")
print(stdout, "runic version ")
print_vnum(stdout, RUNIC_VERSION)
print(stdout, ", julia version ")
print_vnum(stdout, VERSION)
println(stdout)
return
end

Loading…
Cancel
Save