mirror of
https://github.com/CCLeonOS/LeonOS.git
synced 2026-03-03 15:17:01 +00:00
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:
@@ -3,4 +3,4 @@ This help document is not complete.
|
||||
LeonOS's website:
|
||||
|
||||
>>color blue
|
||||
wget run https://gh.catmak.name/https://raw.githubusercontent.com/Leonmmcoset/LeonOS/refs/heads/main/installer.lua
|
||||
https://leonkingdom.netlify.app/leonos/
|
||||
|
||||
@@ -5,9 +5,9 @@ In LeonOS, you can use the `pkg` command to download and install software packag
|
||||
== Basic Usage ==
|
||||
|
||||
Download and install a package:
|
||||
```
|
||||
>>color yellow
|
||||
pkg install <package_name>
|
||||
```
|
||||
>>color white
|
||||
|
||||
== Command Options ==
|
||||
|
||||
@@ -20,60 +20,60 @@ The `pkg install` command supports the following options:
|
||||
== Usage Examples ==
|
||||
|
||||
1. Install a package:
|
||||
```
|
||||
>>color yellow
|
||||
pkg install example-package
|
||||
```
|
||||
>>color white
|
||||
|
||||
2. Force install a package:
|
||||
```
|
||||
>>color yellow
|
||||
pkg install --force example-package
|
||||
```
|
||||
>>color white
|
||||
|
||||
3. Install a package with detailed information:
|
||||
```
|
||||
>>color yellow
|
||||
pkg install -v example-package
|
||||
```
|
||||
>>color white
|
||||
|
||||
4. View help for `pkg install` command:
|
||||
```
|
||||
>>color yellow
|
||||
pkg install --help
|
||||
```
|
||||
>>color white
|
||||
|
||||
== Search for Packages ==
|
||||
|
||||
Before installing a package, you can search for available packages:
|
||||
```
|
||||
>>color yellow
|
||||
pkg search <search_keyword>
|
||||
```
|
||||
>>color white
|
||||
|
||||
Example:
|
||||
```
|
||||
>>color yellow
|
||||
pkg search editor
|
||||
```
|
||||
>>color white
|
||||
|
||||
== View Package Information ==
|
||||
|
||||
Before installing a package, you can view detailed information about it:
|
||||
```
|
||||
>>color yellow
|
||||
pkg info <package_name>
|
||||
```
|
||||
>>color white
|
||||
|
||||
Example:
|
||||
```
|
||||
>>color yellow
|
||||
pkg info example-package
|
||||
```
|
||||
>>color white
|
||||
|
||||
== Update Packages ==
|
||||
|
||||
You can update installed packages using the following command:
|
||||
```
|
||||
>>color yellow
|
||||
pkg update <package_name>
|
||||
```
|
||||
>>color white
|
||||
|
||||
If you don't specify a package name, all installed packages will be updated:
|
||||
```
|
||||
>>color yellow
|
||||
pkg update
|
||||
```
|
||||
>>color white
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
44
data/computercraft/lua/rom/programs/test_help_format.lua
Normal file
44
data/computercraft/lua/rom/programs/test_help_format.lua
Normal 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")
|
||||
34
data/computercraft/lua/rom/programs/test_imageview.lua
Normal file
34
data/computercraft/lua/rom/programs/test_imageview.lua
Normal 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")
|
||||
@@ -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
|
||||
|
||||
-- 主函数
|
||||
|
||||
Reference in New Issue
Block a user