fetch.lua, a program fetching utility
This commit is contained in:
parent
d2ca23d179
commit
8c4cdacb70
1 changed files with 16 additions and 0 deletions
16
fetch.lua
Normal file
16
fetch.lua
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
-- Program to fetch other programs
|
||||
|
||||
local filename = arg[1]
|
||||
local url = "https://git.emersonmakes.com" ..
|
||||
"/filigreed/cc-stuff/raw/branch/main/" ..
|
||||
filename
|
||||
|
||||
result = http.get(url)
|
||||
if result == nil then
|
||||
print(filename .. " is not a valid file to fetch.")
|
||||
os.exit(1)
|
||||
end
|
||||
|
||||
local file = fs.open(filename, "w")
|
||||
file.write(result.readAll())
|
||||
file.close()
|
||||
Loading…
Add table
Add a link
Reference in a new issue