mirror of
https://github.com/CCLeonOS/LeonOS.git
synced 2026-03-03 15:17:01 +00:00
feat(pkg): 更新包管理系统并升级至LeonOS 0.3.6
- 将包安装目录从/leonos/packages迁移至/packages - 更新版本号至0.3.6 - 修改installer.lua以正确处理packages目录 - 更新pkg.lua程序适配新的包路径 - 添加示例包文件到新位置
This commit is contained in:
10
data/computercraft/lua/packages/example-pkg/1.0.0/completions/example.lua
vendored
Normal file
10
data/computercraft/lua/packages/example-pkg/1.0.0/completions/example.lua
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
-- example command completion
|
||||
|
||||
local shell = require('shell')
|
||||
local completion = require('completion')
|
||||
|
||||
-- Set up completion for example command
|
||||
shell.setCompletionFunction('example', completion.build({
|
||||
-- 这里可以添加example命令的补全逻辑
|
||||
completion.choice{'--help', '-h'}
|
||||
}))
|
||||
12
data/computercraft/lua/packages/example-pkg/1.0.0/package.json
vendored
Normal file
12
data/computercraft/lua/packages/example-pkg/1.0.0/package.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "example",
|
||||
"version": "1.0.1",
|
||||
"description": "An example package for LeonOS",
|
||||
"author": "LeonMMcoset",
|
||||
"license": "MIT",
|
||||
"dependencies": {},
|
||||
"files": [
|
||||
"programs/example.lua",
|
||||
"completions/example.lua"
|
||||
]
|
||||
}
|
||||
25
data/computercraft/lua/packages/example-pkg/1.0.0/programs/example.lua
vendored
Normal file
25
data/computercraft/lua/packages/example-pkg/1.0.0/programs/example.lua
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
-- Example Package Program
|
||||
local colors = require('colors')
|
||||
local term = require('term')
|
||||
|
||||
function drawTopBar()
|
||||
local w, h = term.getSize()
|
||||
term.setBackgroundColor(colors.cyan)
|
||||
term.setTextColor(colors.white)
|
||||
term.setCursorPos(1, 1)
|
||||
term.clearLine()
|
||||
local title = "=== Example Package v1.0.0 ==="
|
||||
local pos = math.floor((w - #title) / 2) + 1
|
||||
term.setCursorPos(pos, 1)
|
||||
term.write(title)
|
||||
term.setBackgroundColor(colors.black)
|
||||
term.setTextColor(colors.white)
|
||||
term.setCursorPos(1, 3)
|
||||
end
|
||||
|
||||
drawTopBar()
|
||||
print("\nThis is an example package that demonstrates the features of LeonOS package manager.")
|
||||
print("\nUsage:")
|
||||
print(" pkg install example-pkg - Install this package")
|
||||
print(" pkg remove example-pkg - Uninstall this package")
|
||||
print(" pkg list - List installed packages")
|
||||
Reference in New Issue
Block a user