mirror of
https://github.com/CCLeonOS/LeonOS.git
synced 2026-03-03 15:17:01 +00:00
feat(帮助系统): 添加helplist命令用于列出所有帮助主题
添加helplist.lua程序用于列出所有可用的帮助主题,支持排序和彩色输出选项 同时添加test_helplist.lua测试脚本验证helplist命令功能
This commit is contained in:
63
data/computercraft/lua/rom/programs/test_helplist.lua
Normal file
63
data/computercraft/lua/rom/programs/test_helplist.lua
Normal file
@@ -0,0 +1,63 @@
|
||||
-- test_helplist.lua: Test the helplist command
|
||||
local shell = require("shell")
|
||||
local term = require("term")
|
||||
|
||||
print("=== Testing helplist Command ===")
|
||||
print("This test will run the helplist command with different options")
|
||||
print("to verify it correctly lists all available help topics.")
|
||||
print("
|
||||
Test 1: Basic helplist command")
|
||||
os.sleep(1)
|
||||
term.clear()
|
||||
local success = shell.run("helplist")
|
||||
if not success then
|
||||
print("Error: helplist command failed to run.")
|
||||
else
|
||||
print("
|
||||
Test 1 completed. Press any key to continue.")
|
||||
os.pullEvent("key")
|
||||
end
|
||||
|
||||
print("
|
||||
Test 2: helplist with sorting")
|
||||
os.sleep(1)
|
||||
term.clear()
|
||||
success = shell.run("helplist", "--sort")
|
||||
if not success then
|
||||
print("Error: helplist --sort command failed to run.")
|
||||
else
|
||||
print("
|
||||
Test 2 completed. Press any key to continue.")
|
||||
os.pullEvent("key")
|
||||
end
|
||||
|
||||
print("
|
||||
Test 3: helplist with color")
|
||||
os.sleep(1)
|
||||
term.clear()
|
||||
success = shell.run("helplist", "--color")
|
||||
if not success then
|
||||
print("Error: helplist --color command failed to run.")
|
||||
else
|
||||
print("
|
||||
Test 3 completed. Press any key to continue.")
|
||||
os.pullEvent("key")
|
||||
end
|
||||
|
||||
print("
|
||||
Test 4: helplist help")
|
||||
os.sleep(1)
|
||||
term.clear()
|
||||
success = shell.run("helplist", "--help")
|
||||
if not success then
|
||||
print("Error: helplist --help command failed to run.")
|
||||
else
|
||||
print("
|
||||
Test 4 completed. Press any key to finish.")
|
||||
os.pullEvent("key")
|
||||
end
|
||||
|
||||
term.clear()
|
||||
print("=== helplist Command Tests Completed ===")
|
||||
print("All tests have been executed.")
|
||||
print("You can now use the 'helplist' command to list all available help topics.")
|
||||
Reference in New Issue
Block a user