From 7ebd710a3c234e5cc28c0a74179d8b46b8f93137 Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Mon, 1 Sep 2025 22:14:57 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7=E8=87=B30.3.2=E5=B9=B6=E9=87=8D=E6=9E=84pkg=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=E8=A1=A5=E5=85=A8=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将installer.lua和bios.lua中的版本号从0.3.1更新至0.3.2 使用completion.build重构pkg命令补全逻辑,简化代码结构 --- data/computercraft/lua/bios.lua | 4 +-- .../computercraft/lua/rom/completions/pkg.lua | 31 ++----------------- installer.lua | 2 +- 3 files changed, 6 insertions(+), 31 deletions(-) diff --git a/data/computercraft/lua/bios.lua b/data/computercraft/lua/bios.lua index ebb9b59..1658356 100644 --- a/data/computercraft/lua/bios.lua +++ b/data/computercraft/lua/bios.lua @@ -1,4 +1,4 @@ -_G._HOST = _G._HOST .. " (LeonOS 0.3.1)" +_G._HOST = _G._HOST .. " (LeonOS 0.3.2)" local fs = rawget(_G, "fs") _G._RC_ROM_DIR = _RC_ROM_DIR or (...) and fs.exists("/leonos") and "/leonos" or "/rom" @@ -32,7 +32,7 @@ local rc = { _VERSION = { major = 0, minor = 3, - patch = 1 + patch = 2 }, queueEvent = pull(os, "queueEvent"), startTimer = pull(os, "startTimer"), diff --git a/data/computercraft/lua/rom/completions/pkg.lua b/data/computercraft/lua/rom/completions/pkg.lua index 3a51db4..4398364 100644 --- a/data/computercraft/lua/rom/completions/pkg.lua +++ b/data/computercraft/lua/rom/completions/pkg.lua @@ -1,31 +1,6 @@ --- pkg command completion local shell = require("shell") local completion = require("cc.shell.completion") --- 定义pkg命令的补全函数 -local function pkg_completion(shell, index, text, previous) - -- 子命令补全 - if index == 1 then - return completion.choice(text, {"install", "update", "remove", "list", "search", "info", "help"}) - end - - -- 选项补全 (--force, --local) - if text:sub(1, 2) == "--" then - return completion.choice(text, {"--force", "--local"}) - end - - -- 命令特定补全 - local command = previous[1] - if command == "install" or command == "update" or command == "remove" or command == "info" then - -- 这里可以添加包名补全逻辑 - -- 目前返回空列表 - return {} - elseif command == "search" then - -- 搜索查询不需要特定补全 - return {} - end - - return {} -end - -shell.setCompletionFunction("pkg", pkg_completion) \ No newline at end of file +shell.setCompletionFunction("pkg", completion.build( + completion.choice{"install", "update", "remove", "list", "search", "info", "help"}, +)) diff --git a/installer.lua b/installer.lua index fae6e10..7eae902 100644 --- a/installer.lua +++ b/installer.lua @@ -1,5 +1,5 @@ -- LeonOS installer -local INSTALLER_VERSION = "0.3.1" +local INSTALLER_VERSION = "0.3.2" local DEFAULT_ROM_DIR = "/leonos" print("Start loading LeonOS installer ("..INSTALLER_VERSION..")...")