From fe08446d84e0aa939780ad013f0545778703da6d Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Fri, 19 Jul 2019 14:10:39 -0400 Subject: MBS as default shell --- .mbs/bin/help.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .mbs/bin/help.lua (limited to '.mbs/bin/help.lua') diff --git a/.mbs/bin/help.lua b/.mbs/bin/help.lua new file mode 100644 index 0000000..f92630f --- /dev/null +++ b/.mbs/bin/help.lua @@ -0,0 +1,19 @@ +local topic = ... or "intro" + +if topic == "index" then + print("Help topics availiable:") + textutils.pagedTabulate(help.topics()) +else + local file_name = help.lookup(topic) + if not file_name then error("No help available", 0) end + + local file = fs.open(file_name, "r") + -- Shouldn't happen, but nice to handle anyway + if not file then error("No help available", 0) end + + local contents = file.readAll() + file.close() + + local _, height = term.getCursorPos() + textutils.pagedPrint(contents, height - 3) +end \ No newline at end of file -- cgit v1.2.3