refactor(shell): 使用textutils.coloredPrint优化提示符显示

将shell提示符的拼接方式改为使用textutils.coloredPrint函数,提高代码可读性和维护性
This commit is contained in:
2025-08-31 19:56:01 +08:00
parent 3541658c24
commit 8c2b73b845

View File

@@ -66,7 +66,7 @@ local history = {}
while true do while true do
term.setTextColor(colors.yellow) term.setTextColor(colors.yellow)
term.setBackgroundColor(colors.black) term.setBackgroundColor(colors.black)
rc.write(colors.yellow.."$"..shell.dir()..colors.green.." >>> ") rc.write(textutils.coloredPrint(colors.yellow, "$"..shell.dir(), colors.green, " >>> "))
term.setTextColor(colors.white) term.setTextColor(colors.white)
local text = term.read(nil, history, shell.complete) local text = term.read(nil, history, shell.complete)