fix(installer): 更新安装程序版本至0.3.7 Beta 9

docs(help): 更新about.hlp中的网站链接至新域名
refactor(help): 优化pkg_download_en.hlp的代码块显示格式
feat(imageview): 添加图像加载错误提示和注释说明
style(time): 修复帮助文档格式错误
feat(shell): 添加欢迎界面图形显示
test: 新增imageview和help文档的测试程序
This commit is contained in:
2025-09-02 16:29:22 +08:00
parent 055bd09311
commit 119f43b7cc
8 changed files with 126 additions and 30 deletions

View File

@@ -1,4 +1,6 @@
-- imageview.lua: Image viewer that loads from URL
-- This program uses paintutils library for image handling (CC Tweaked standard)
-- There is no 'image' API; we use paintutils.loadImage and paintutils.drawImage
local http = require("http")
local paintutils = require("paintutils")
local term = require("term")
@@ -59,6 +61,7 @@ local function main(args)
if not success then
print("Error loading image: " .. image)
print("Make sure the URL points to a valid image file compatible with CC Tweaked.")
return
end

View File

@@ -27,10 +27,24 @@ local textutils = require("textutils")
if os.version then
textutils.coloredPrint(colors.yellow, os.version(), colors.white)
local image = paintutils.parseImage([[
f f
f f
ffff
]])
paintutils.drawImage(image, term.getCursorPos())
else
textutils.coloredPrint(colors.yellow, rc.version(), colors.white)
local image = paintutils.parseImage([[
f f
f f
ffff
]])
paintutils.drawImage(image, term.getCursorPos())
end
-- textutils.coloredPrint(colors.yellow, "Welcome using the beta version of LeonOS!"colors.white)
textutils.coloredPrint(colors.yellow, "Welcome using the beta version of LeonOS!", colors.white)
thread.vars().parentShell = thread.id()
shell.init(_ENV)

View File

@@ -0,0 +1,44 @@
-- test_help_format.lua: Test the formatted pkg_download_en help document
local help = require("rom/programs/help")
local term = require("term")
print("=== Testing pkg_download_en Help Document Formatting ===")
print("This test will display the pkg_download_en help document")
print("to verify that code blocks are properly formatted with colors.")
print("\n3...")
os.sleep(1)
print("2...")
os.sleep(1)
print("1...")
os.sleep(1)
-- Clear screen and display help document
term.clear()
term.setCursorPos(1, 1)
local success, content = pcall(function()
return help.loadTopic("pkg_download_en")
end)
if success and content then
-- Process the content to simulate how help system would display it
print("=== pkg_download_en Help Document ===")
for line in content:gmatch("[^
]+") do
-- Handle color commands
if line:match("^>>color yellow") then
term.setTextColor(0xFFFF00)
elseif line:match("^>>color white") then
term.setTextColor(0xFFFFFF)
else
print(line)
end
end
term.setTextColor(0xFFFFFF) -- Reset to white
print("\n=== End of Help Document ===")
else
print("Error: Could not load pkg_download_en help document.")
end
print("\nTest finished. Press any key to return.")
os.pullEvent("key")

View File

@@ -0,0 +1,34 @@
-- test_imageview.lua: Test the imageview command
local shell = require("shell")
print("=== Image Viewer Test ===")
print("Note: This program uses the paintutils library for image handling,")
print(" not an 'image' API. CC Tweaked doesn't have an 'image' API.")
print("")
print("Testing imageview command with a sample image...")
print("This will attempt to load a test image from the internet.")
print("Press Ctrl+T to stop the test if needed.")
print("\nNote: You need an internet connection for this test.")
print("\n3...")
os.sleep(1)
print("2...")
os.sleep(1)
print("1...")
os.sleep(1)
-- Use a sample image URL that's known to work
local testImageUrl = "http://time.syiban.com/img/xcx.png"
-- Execute the imageview command with the test URL
local success, errorMsg = shell.execute("imageview " .. testImageUrl)
if success then
print("\nTest completed successfully.")
print("The image viewer is working correctly with paintutils.")
else
print("\nTest failed: " .. errorMsg)
print("Make sure you have internet access and the URL is valid.")
end
print("\nTest finished. Press any key to return.")
os.pullEvent("key")

View File

@@ -18,11 +18,12 @@ Formats for --format option:
]])
print(" %A: Full weekday name")
print(" %B: Full month name")
print("
Examples:")
print(" time # Show current time in default format")
print(" time --format '%Y-%m-%d %H:%M:%S' # Show time as YYYY-MM-DD HH:MM:SS")
print(" time -f '%A, %B %d, %Y' # Show time as 'Monday, January 01, 2023'")
print([[
Examples:
time # Show current time in default format
time --format '%Y-%m-%d %H:%M:%S' # Show time as YYYY-MM-DD HH:MM:SS
time -f '%A, %B %d, %Y' # Show time as 'Monday, January 01, 2023'
]])
end
-- 主函数