Skip to content

Commit

Permalink
New version of IsAvailable.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
Leticia-maria authored Nov 27, 2021
1 parent c9de255 commit c664ea4
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/IsAvailable.jl
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c664ea4

Please sign in to comment.