updates
CI / test (push) Failing after 4m56s

This commit is contained in:
Raven Scott
2026-04-02 22:35:09 -04:00
parent efeee0088a
commit 2e26b14250
56 changed files with 1838 additions and 75 deletions
+29
View File
@@ -0,0 +1,29 @@
async function run(ctx, argv) {
const vfs = ctx.vfs
let n = 10
let start = 1
if (argv[1] === '-n' && argv[2]) {
n = parseInt(argv[2], 10) || 10
start = 3
}
const files = argv.slice(start).filter((a) => a !== '--')
const take = (s) => {
let lines = s.split('\n')
if (s.endsWith('\n') && lines[lines.length - 1] === '') lines.pop()
const slice = lines.length <= n ? lines : lines.slice(-n)
ctx.console.log(slice.join('\n'))
}
if (!files.length) {
take(bareStdin(ctx))
return
}
for (const f of files) {
const buf = await vfs.readFile(f)
if (!buf) {
ctx.console.error('tail: ' + f + ': No such file')
continue
}
if (files.length > 1) ctx.console.log('==> ' + f + ' <==')
take(ctx.b4a.toString(buf))
}
}