From 565da37a34229c4990fef5f9ebb07ce033251255 Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Mon, 1 Sep 2025 16:29:34 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0ver=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E5=B9=B6=E6=9B=B4=E6=96=B0LeonOS=E7=89=88=E6=9C=AC=E8=87=B30.1?= =?UTF-8?q?.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增ver命令用于显示LeonOS版本信息 - 更新installer.lua和bios.lua中的版本号至0.1.8 - 为ver命令添加shell别名和补全功能 --- data/computercraft/lua/bios.lua | 4 ++-- data/computercraft/lua/rom/completions/ver.lua | 6 ++++++ data/computercraft/lua/rom/programs/shell.lua | 3 ++- data/computercraft/lua/rom/programs/ver.lua | 5 +++++ installer.lua | 2 +- 5 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 data/computercraft/lua/rom/completions/ver.lua create mode 100644 data/computercraft/lua/rom/programs/ver.lua diff --git a/data/computercraft/lua/bios.lua b/data/computercraft/lua/bios.lua index 66571ff..ff923d9 100644 --- a/data/computercraft/lua/bios.lua +++ b/data/computercraft/lua/bios.lua @@ -1,4 +1,4 @@ -_G._HOST = _G._HOST .. " (LeonOS 0.1.7)" +_G._HOST = _G._HOST .. " (LeonOS 0.1.8)" 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 = 1, - patch = 7 + patch = 8 }, queueEvent = pull(os, "queueEvent"), startTimer = pull(os, "startTimer"), diff --git a/data/computercraft/lua/rom/completions/ver.lua b/data/computercraft/lua/rom/completions/ver.lua new file mode 100644 index 0000000..0563b69 --- /dev/null +++ b/data/computercraft/lua/rom/completions/ver.lua @@ -0,0 +1,6 @@ +local shell = require("shell") +local completion = require("cc.shell.completion") + +shell.setCompletionFunction("ver", completion.build( + -- ver命令不接受参数,所以这里没有额外的补全选项 +)) \ No newline at end of file diff --git a/data/computercraft/lua/rom/programs/shell.lua b/data/computercraft/lua/rom/programs/shell.lua index c4f2bd8..8881fd4 100644 --- a/data/computercraft/lua/rom/programs/shell.lua +++ b/data/computercraft/lua/rom/programs/shell.lua @@ -67,7 +67,8 @@ local aliases = { rs = "redstone", sh = "shell", ps = "threads", - restart = "reboot" + restart = "reboot", + version = "ver" } for k, v in pairs(aliases) do diff --git a/data/computercraft/lua/rom/programs/ver.lua b/data/computercraft/lua/rom/programs/ver.lua new file mode 100644 index 0000000..14ce6ce --- /dev/null +++ b/data/computercraft/lua/rom/programs/ver.lua @@ -0,0 +1,5 @@ +-- LeonOS version command +local rc = require("rc") + +-- Display LeonOS version +print(rc.version()) \ No newline at end of file diff --git a/installer.lua b/installer.lua index 7da55e1..f3273c6 100644 --- a/installer.lua +++ b/installer.lua @@ -1,5 +1,5 @@ -- LeonOS installer -local INSTALLER_VERSION = "0.1.7" +local INSTALLER_VERSION = "0.1.8" local DEFAULT_ROM_DIR = "/leonos" print("Start loading LeonOS installer...")