Skip to content

Commit

Permalink
Documentation Added
Browse files Browse the repository at this point in the history
  • Loading branch information
Leticia-maria committed Nov 27, 2021
1 parent e2b54f9 commit 9e40dff
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/IsAvailable.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module IsAvailable

@doc """ A function that gets the status of a package at the link https://juliapackages.com/p/ """ ->
function isavailable(name::String)
url = "https://juliapackages.com/p/"*lowercase(name)
try
Expand All @@ -12,17 +13,25 @@ function isavailable(name::String)
end
end

@doc """ A function that gets the status of several packages in a list""" ->
function app(names::Array{String, 1})
for name in names
if isavailable(name)
print(name*" is available. Do you wanna to install it? [type y(yes) or n(no)] ")
answer = readline()
if lowercase(answer) == "y"
Pkg.add(name)
elseif lowercase(answer) == "n"
validAnswers = ["yes", "no", "y", "n"]
while lowercase(answer) validAnswers
print("Please, type some valid option: [y] yes and [n] no. ")
answer = readline()
end
if lowercase(answer) ["yes", "y"]
try
Pkg.add(name)
catch
print("Oops! I did it again. Check out the name of the package... It may be wrong")
end
elseif lowercase(answer) ["no", "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
Expand Down

0 comments on commit 9e40dff

Please sign in to comment.