2025-09-01 16:29:34 +08:00
|
|
|
-- LeonOS version command
|
|
|
|
|
local rc = require("rc")
|
2025-09-01 16:34:09 +08:00
|
|
|
local textutils = require("textutils")
|
2025-09-01 16:29:34 +08:00
|
|
|
|
2025-09-01 16:49:13 +08:00
|
|
|
-- 程序顶部名称栏
|
|
|
|
|
local term = require("term")
|
|
|
|
|
local colors = require("colors")
|
|
|
|
|
|
|
|
|
|
-- 保存当前颜色设置
|
|
|
|
|
local old_fg = term.getTextColor()
|
|
|
|
|
local old_bg = term.getBackgroundColor()
|
|
|
|
|
|
|
|
|
|
-- 设置名称栏颜色并显示
|
|
|
|
|
term.setTextColor(colors.white)
|
|
|
|
|
term.setBackgroundColor(colors.cyan)
|
|
|
|
|
term.at(1, 1).clearLine()
|
|
|
|
|
term.at(1, 1).write("=== LeonOS Version ===")
|
|
|
|
|
|
|
|
|
|
-- 恢复颜色设置
|
|
|
|
|
term.setTextColor(old_fg)
|
|
|
|
|
term.setBackgroundColor(old_bg)
|
|
|
|
|
term.at(1, 2)
|
|
|
|
|
|
2025-09-01 16:29:34 +08:00
|
|
|
-- Display LeonOS version
|
2025-09-01 16:34:09 +08:00
|
|
|
textutils.coloredPrint(colors.yellow, rc.version(), colors.white)
|