IonutParau 687cfebd00 testing version of LuaBIOS and OpenOS
people were having issues getting them to work so now we promote consistency
2025-06-28 20:41:49 +02:00

21 lines
585 B
Lua

local fs = require("filesystem")
local shell = require("shell")
local args = shell.parse(...)
if #args == 0 then
io.write("Usage: man <topic>\n")
io.write("Where `topic` will usually be the name of a program or library.\n")
return 1
end
local topic = args[1]
for path in string.gmatch(os.getenv("MANPATH"), "[^:]+") do
path = shell.resolve(fs.concat(path, topic), "man")
if path and fs.exists(path) and not fs.isDirectory(path) then
os.execute(os.getenv("PAGER") .. " " .. path)
os.exit()
end
end
io.stderr:write("No manual entry for " .. topic .. '\n')
return 1