aboutsummaryrefslogtreecommitdiff
path: root/.mbs/bin/help.lua
diff options
context:
space:
mode:
Diffstat (limited to '.mbs/bin/help.lua')
-rw-r--r--.mbs/bin/help.lua19
1 files changed, 19 insertions, 0 deletions
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