This commit is contained in:
unknown 2022-02-20 20:28:41 -05:00
parent aca2f138a8
commit c46ec76c63
3 changed files with 23 additions and 1 deletions

View File

@ -0,0 +1,7 @@
{
"name": "cat",
"license": "MIT",
"version": 0.1,
"engine": 0.44,
"help": "output file to the terminal"
}

View File

@ -0,0 +1,15 @@
function cat(pos, input, data)
local path = computers.devicepath .. "/" .. minetest.hash_node_position(pos) .. data.element.pwd
local files = computers.api.get_dir_keyed_list(path, false)
if files[input] then
local f = io.open(path .. "/" .. input)
local fdata = f:read("*all")
f:close()
return fdata
else
return "file not found"
end
end
return cat

View File

@ -8,7 +8,7 @@ minetest.mkdir(computers.devicepath) --make sure it exists
minetest.mkdir(computers.networkpath) --make sure it exists
computers.os = {
version = 0.43,
version = 0.44,
name = "kuto",
authors = {"wsor", "luk3yx"},
license = "MIT",