feat: 更新安装程序版本并添加新功能和程序

更新安装程序版本至0.3.6 Beta 4
为shell程序添加package别名
新增applist程序用于列出/app目录下的应用
This commit is contained in:
2025-09-02 12:30:03 +08:00
parent ba91828c01
commit c927b19cb2
3 changed files with 79 additions and 2 deletions

View File

@@ -0,0 +1,76 @@
-- applist.lua - List applications in /app directory
local fs = require("fs")
local tu = require("textutils")
local function show_help()
print("Usage: applist [options]")
print("Lists all applications in the /app directory")
print("")
print("Options:")
print(" --help, -h Show this help message")
print(" --verbose, -v Show more details about each application")
end
local function list_apps(verbose)
local app_dir = "/app"
-- 检查app目录是否存在
if not fs.exists(app_dir) then
print("No applications directory found at /app")
return
end
-- 获取app目录中的文件列表
local files = fs.list(app_dir)
if #files == 0 then
print("No applications installed in /app directory")
return
end
print("Installed applications:")
print("======================")
for _, file in ipairs(files) do
local file_path = fs.combine(app_dir, file)
local is_dir = fs.isDir(file_path)
if is_dir then
-- 如果是目录,可能是一个应用程序文件夹
print("[" .. file .. "]")
if verbose then
-- 在详细模式下,显示目录中的.lua文件
local sub_files = fs.list(file_path)
for _, sub_file in ipairs(sub_files) do
if sub_file:sub(-4) == ".lua" then
print(" - " .. sub_file)
end
end
end
elseif file:sub(-4) == ".lua" then
-- 如果是.lua文件直接显示
print(file:sub(1, -5)) -- 移除.lua扩展名
end
end
end
local function main(args)
local verbose = false
-- 解析命令行参数
for _, arg in ipairs(args) do
if arg == "--help" or arg == "-h" then
show_help()
return
elseif arg == "--verbose" or arg == "-v" then
verbose = true
end
end
list_apps(verbose)
end
-- 运行主函数
local args = {...}
main(args)

View File

@@ -69,7 +69,8 @@ local aliases = {
sh = "shell",
ps = "threads",
restart = "reboot",
version = "ver"
version = "ver",
package = "pkg"
}
for k, v in pairs(aliases) do