Skip to content

Commit 9e40dff

Browse files
committed
Documentation Added
1 parent e2b54f9 commit 9e40dff

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/IsAvailable.jl

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module IsAvailable
22

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

16+
@doc """ A function that gets the status of several packages in a list""" ->
1517
function app(names::Array{String, 1})
1618
for name in names
1719
if isavailable(name)
1820
print(name*" is available. Do you wanna to install it? [type y(yes) or n(no)] ")
1921
answer = readline()
20-
if lowercase(answer) == "y"
21-
Pkg.add(name)
22-
elseif lowercase(answer) == "n"
22+
validAnswers = ["yes", "no", "y", "n"]
23+
while lowercase(answer) validAnswers
24+
print("Please, type some valid option: [y] yes and [n] no. ")
25+
answer = readline()
26+
end
27+
if lowercase(answer) ["yes", "y"]
28+
try
29+
Pkg.add(name)
30+
catch
31+
print("Oops! I did it again. Check out the name of the package... It may be wrong")
32+
end
33+
elseif lowercase(answer) ["no", "n"]
2334
print("Okay... Bye!")
24-
else
25-
print("Oops! I did it again. Check out the name of the package... It may be wrong")
2635
end
2736
end
2837
end

0 commit comments

Comments
 (0)