Files
bare-operating-system/examples/tui-summon/index.js
T
Raven Scott 15afc148d7
Release rolling / release (push) Successful in 9m30s
Updates
2026-08-13 00:13:03 -04:00

32 lines
837 B
JavaScript

/** Guest sample: summon-shaped TUI without a live fetch. */
async function run(ctx) {
if (!ctx.tui || !ctx.tui.isTTY()) {
ctx.console.error('tui-summon example: needs a TTY')
ctx.exitCode = 1
return
}
await ctx.tui.run(
{
update: function (msg) {
if (ctx.tui.key.matches(msg, 'q', 'ctrl+c')) return [this, ctx.tui.quit]
return [this, null]
},
view: function () {
return ctx.tui
.style()
.border(ctx.tui.style.borders.rounded)
.width(60)
.render(
'summon example (no network)\n\n' +
'summon — text browser for Bare OS\n' +
'JS is off. HTTP via ctx.httpFetch.\n\n' +
'Real client: /bin/summon\n' +
'q quit'
)
}
},
{ buffer: 'cell' }
)
}