forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.jl
21 lines (19 loc) · 669 Bytes
/
utils.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function version()
major = Ref{Cint}(0)
minor = Ref{Cint}(0)
patch = Ref{Cint}(0)
ccall((:git_libgit2_version, :libgit2), Void,
(Ptr{Cint}, Ptr{Cint}, Ptr{Cint}), major, minor, patch)
return VersionNumber(major[], minor[], patch[])
end
isset(val::Integer, flag::Integer) = (val & flag == flag)
function prompt(msg::AbstractString; default::AbstractString="", password::Bool=false)
msg = !isempty(default) ? msg*" [$default]:" : msg*":"
uinput = if password
bytestring(ccall(:getpass, Cstring, (Cstring,), msg))
else
print(msg)
chomp(readline(STDIN))
end
isempty(uinput) ? default : uinput
end