feat: 添加历史记录和配置管理命令及相关测试

fix(project_rules): 修正文档中的中文支持说明

chore: 更新版本号至0.3.8

feat: 新增history命令用于查看和管理命令历史记录
feat: 新增config命令用于管理系统配置
feat: 新增find命令用于文件搜索
docs: 添加新命令建议文档
test: 添加history、config和find命令的测试脚本
This commit is contained in:
2025-09-02 22:22:25 +08:00
parent 27d32e99ed
commit 7e07e1636f
10 changed files with 896 additions and 4 deletions

View File

@@ -0,0 +1,72 @@
-- test_history.lua: Test the history command
local shell = require("shell")
local term = require("term")
print("=== Testing history Command ===")
print("This test will run the history command with different options")
print("to verify it correctly manages command history.")
print("
First, let's execute some commands to populate history...")
-- Execute some commands to populate history
shell.run("echo Hello, World!")
shell.run("list")
shell.run("help")
print("
Test 1: Basic history command")
os.sleep(1)
term.clear()
local success = shell.run("history")
if not success then
print("Error: history command failed to run.")
else
print("
Test 1 completed. Press any key to continue.")
os.pullEvent("key")
end
print("
Test 2: Search history")
os.sleep(1)
term.clear()
success = shell.run("history", "-s", "he")
if not success then
print("Error: history search command failed to run.")
else
print("
Test 2 completed. Press any key to continue.")
os.pullEvent("key")
end
print("
Test 3: Execute command from history")
os.sleep(1)
term.clear()
print("Executing command #1 from history (should be 'echo Hello, World!')")
success = shell.run("history", "1")
if not success then
print("Error: history execution command failed to run.")
else
print("
Test 3 completed. Press any key to continue.")
os.pullEvent("key")
end
print("
Test 4: history help")
os.sleep(1)
term.clear()
success = shell.run("history", "--help")
if not success then
print("Error: history help command failed to run.")
else
print("
Test 4 completed. Press any key to finish.")
os.pullEvent("key")
end
term.clear()
print("=== history Command Tests Completed ===")
print("All tests have been executed.")
print("You can now use the 'history' command to manage your command history.")