From 65ebd655744411d45ad467c656209e008bc489f3 Mon Sep 17 00:00:00 2001 From: Reinaldy Rafli Date: Wed, 15 Sep 2021 12:30:02 +0700 Subject: [PATCH] using Downloads instead of HTTP package --- bin/add-gitignore | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/bin/add-gitignore b/bin/add-gitignore index 199ca86..011e85a 100755 --- a/bin/add-gitignore +++ b/bin/add-gitignore @@ -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)