Add tty-write command (#1961)

This command offers a synchronized way to write to /dev/tty.
This commit is contained in:
Joe Lim authored and GitHub committed 2025-04-13 11:14:00 +10:00
1 parent 0df0c0f5ff
commit 1cb9e9d14a
5 files changed
+50 -10

No files matched your search

+13
View File
@@ -1061,6 +1061,19 @@ func (e *callExpr) eval(app *app, args []string) {
app.ui.loadFile(app, true)
app.ui.loadFileInfo(app.nav)
}
case "tty-write":
if len(e.args) != 1 {
app.ui.echoerr("tty-write: requires an argument")
return
}
tty, ok := app.ui.screen.Tty()
if !ok {
log.Printf("tty-write: failed to get tty")
return
}
tty.Write([]byte(e.args[0]))
case "scroll-down":
if !app.nav.init {
return