Files
Halyde/halyde/apps/cat.lua
T
2025-04-27 18:25:12 +03:00

21 lines
421 B
Lua

local args = {...}
local file = args[1]
args = nil
local fs = import("filesystem")
if not file then
shell.run("help cat")
return
end
if file:sub(1, 1) ~= "/" then
file = shell.workingDirectory .. file
end
if not fs.exists(file) then
print("\27[91mFile does not exist.")
end
local handle = fs.open(file, "r")
local data
repeat
data = handle:read(math.huge or math.maxinteger)
print(data, false)
until not data