Terminal
Terminal
Section titled “Terminal”Terminal Host 执行具有 stdin/stdout/stderr 访问权限的 Lua 脚本。
Entry 类型
Section titled “Entry 类型”| Kind | 描述 |
|---|---|
terminal.host | Terminal 会话 host |
- name: cli_host kind: terminal.host hide_logs: false lifecycle: auto_start: true| 字段 | 类型 | 默认值 | 描述 |
|---|---|---|---|
hide_logs | bool | false | 禁止向事件总线输出日志 |
Terminal 上下文
Section titled “Terminal 上下文”在 terminal host 上运行的脚本接收一个 terminal 上下文,包含:
- stdin - 标准输入读取器
- stdout - 标准输出写入器
- stderr - 标准错误写入器
- args - 命令行参数
Lua API
Section titled “Lua API”IO 模块 提供 terminal 操作:
local io = require("io")
io.write("Enter name: ")local name = io.readline()io.print("Hello, " .. name)
local args = io.args()在 terminal 上下文之外调用函数会返回错误。
- Terminal I/O — stdin/stdout/stderr 操作
- TTY — 原始输入事件、样式和布局