mirror of https://github.com/aldy505/dotfiles.git
using Downloads instead of HTTP package
This commit is contained in:
parent
f8218dc843
commit
65ebd65574
|
@ -1,9 +1,6 @@
|
|||
#!/usr/bin/env julia
|
||||
|
||||
import Pkg
|
||||
Pkg.add("HTTP")
|
||||
|
||||
using HTTP
|
||||
using Downloads
|
||||
|
||||
if length(ARGS) == 0
|
||||
println("please specify the gitignore template")
|
||||
|
@ -17,16 +14,15 @@ end
|
|||
|
||||
template = ARGS[1]
|
||||
|
||||
r = HTTP.request("GET", "https://www.toptal.com/developers/gitignore/api/$template")
|
||||
r = Downloads.request(
|
||||
"https://www.toptal.com/developers/gitignore/api/$template";
|
||||
method = "GET", throw = false, output = ".gitignore",
|
||||
)
|
||||
|
||||
if r.status != 200
|
||||
println("the template specified does not exist")
|
||||
exit(1)
|
||||
end
|
||||
|
||||
open(".gitignore", "a") do io
|
||||
write(io, String(r.body))
|
||||
end
|
||||
|
||||
println("gitignore successfully written")
|
||||
exit(0)
|
||||
|
|
Loading…
Reference in New Issue