diff --git a/src/juliac.jl b/src/juliac.jl index 5e0141f..616fdce 100644 --- a/src/juliac.jl +++ b/src/juliac.jl @@ -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) diff --git a/src/main.jl b/src/main.jl index 8008cc2..0caab85 100644 --- a/src/main.jl +++ b/src/main.jl @@ -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 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() 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