implement cat script

This commit is contained in:
Matthieu Jolimaitre 2024-05-15 00:33:54 +02:00
parent 62cd230d5b
commit 7007a2c994

View file

@ -1,8 +1,17 @@
local arg1, arg2, arg3 = ...
local path = ...
local function main()
print("arg1", arg1, "arg2", arg2, "arg3", arg3)
local file = fs.open()
if path == nil then
print("Usage: cat <path>")
return
end
local file = fs.open(path, "r")
if file == nil then
print("No such file:", path)
return
end
local content = file.readAll()
print(content)
end
main()