-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c9de255
commit c664ea4
Showing
1 changed file
with
21 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |