dotfiles/bin/add-gitignore

29 lines
550 B
Plaintext
Raw Normal View History

2021-09-11 09:35:48 +00:00
#!/usr/bin/env julia
using Downloads
2021-09-11 09:35:48 +00:00
if length(ARGS) == 0
println("please specify the gitignore template")
exit(0)
end
if isfile(".gitignore")
println("gitignore file already exists, delete that if you wanna make a new one")
exit(0)
end
template = ARGS[1]
r = Downloads.request(
"https://www.toptal.com/developers/gitignore/api/$template";
method = "GET", throw = false, output = ".gitignore",
)
2021-09-11 09:35:48 +00:00
if r.status != 200
println("the template specified does not exist")
exit(1)
end
println("gitignore successfully written")
exit(0)