diff --git a/cc-tweaked/scripts/cat.lua b/cc-tweaked/scripts/cat.lua index d92e5af..b3e0820 100644 --- a/cc-tweaked/scripts/cat.lua +++ b/cc-tweaked/scripts/cat.lua @@ -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 ") + 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()