20 lines
541 B
Plaintext
20 lines
541 B
Plaintext
/** Shared helpers for drive-resident /bin scripts (prepended before each command). */
|
|
function bareStdin(ctx) {
|
|
return typeof ctx.shellStdin === 'string' ? ctx.shellStdin : ''
|
|
}
|
|
|
|
async function run(ctx, argv) {
|
|
const seq = '\x1b[H\x1b[2J\x1b[3J'
|
|
if (typeof ctx.writeScreen === 'function') {
|
|
ctx.writeScreen(seq)
|
|
return
|
|
}
|
|
globalThis.console.clear?.()
|
|
const ps = globalThis.process?.stdout
|
|
if (ps && typeof ps.write === 'function') {
|
|
ps.write(seq)
|
|
return
|
|
}
|
|
for (let i = 0; i < 48; i++) ctx.console.log('')
|
|
}
|