diff --git a/src/IsAvailable.jl b/src/IsAvailable.jl index 255b069..0cb986d 100644 --- a/src/IsAvailable.jl +++ b/src/IsAvailable.jl @@ -1,15 +1,31 @@ module IsAvailable -function isavailable(name) - url = "https://juliapackages.com/p/"*name +function isavailable(name::String) + url = "https://juliapackages.com/p/"*lowercase(name) try - r = HTTP.get(y) + r = HTTP.get(url) if r.status == 200 - print("is available") + return true end catch - print("not available") + return false end end +function app(names::Array{String, 1}) + for name in names + if isavailable(name) + print(name*" is available. Do you wanna to install it? [yN] ") + answer = readline() + if answer == "y" + Pkg.add(name) + elseif answer == "N" + print("Okay... Bye!") + else + print("Oops! I did it again. Check out the name of the package... It may be wrong") + end + end + end +end + end # module