Implemented all plan to-dos end-to-end, including regeneration of staged bins, and verified with build + booter tests.
What changed
Fixed /bin generation for AsyncFunction execution in build pipeline:
Added appctl preamble wiring (p2p-suite.js) in packages/bare-os-coreutils/build.mjs.
Added a stripRunExport transform to remove trailing export { run } from generated /bin scripts.
Updated cut delimiter parsing in packages/bare-os-coreutils/src/cut.js:
Supports both -d X and attached -dX forms (including -d' ').
Validates -d argument presence and enforces single-character delimiter.
Improved uname -a output in packages/bare-os-coreutils/src/uname.js:
Better release/version derivation from env and /etc/os-release.
Uses env-backed machine architecture fallback instead of hardcoded unknown where available.
Added help aliases in packages/bare-os-coreutils/src/git-pear.js:
git-pear --help and git-pear -h now map to help output.
Reduced persistent invalid timer spam in packages/bare-os-booter/lib/bare-cron.js:
Added per-file parse-error dedupe/rate-limiting (first-seen, content-change, then hourly).
Added actionable invalid timer format hint in log message.
This commit is contained in:
+32
-11
@@ -88,14 +88,42 @@ function bareOsEmitRaw(ctx, chunk) {
|
||||
}
|
||||
|
||||
async function run(ctx, argv) {
|
||||
let delim = '\t'
|
||||
let delimChar = '\t'
|
||||
let fieldsSpec = ''
|
||||
let suppressNoDelim = false
|
||||
const files = []
|
||||
function decodeDelim(raw) {
|
||||
if (raw === '\\t') return '\t'
|
||||
if (raw === '\\n') return '\n'
|
||||
if (raw === '\\0') return '\0'
|
||||
return raw
|
||||
}
|
||||
for (let i = 1; i < argv.length; i++) {
|
||||
const a = argv[i]
|
||||
if (a === '-d') {
|
||||
delim = argv[++i] || ''
|
||||
const raw = argv[++i]
|
||||
if (raw == null) {
|
||||
ctx.console.error('cut: option -d requires an argument')
|
||||
ctx.exitCode = 1
|
||||
return
|
||||
}
|
||||
const parsed = decodeDelim(raw)
|
||||
if (parsed.length !== 1) {
|
||||
ctx.console.error('cut: delimiter must be a single character')
|
||||
ctx.exitCode = 1
|
||||
return
|
||||
}
|
||||
delimChar = parsed
|
||||
continue
|
||||
}
|
||||
if (a.startsWith('-d') && a.length > 2) {
|
||||
const parsed = decodeDelim(a.slice(2))
|
||||
if (parsed.length !== 1) {
|
||||
ctx.console.error('cut: delimiter must be a single character')
|
||||
ctx.exitCode = 1
|
||||
return
|
||||
}
|
||||
delimChar = parsed
|
||||
continue
|
||||
}
|
||||
if (a === '-f') {
|
||||
@@ -142,21 +170,14 @@ async function run(ctx, argv) {
|
||||
return
|
||||
}
|
||||
|
||||
const delimChar = delim === '\\t' ? '\t' : delim
|
||||
|
||||
async function cutLines(text) {
|
||||
const lines = text.split(/\r?\n/)
|
||||
for (const line of lines) {
|
||||
if (line === '' && lines.length === 1) continue
|
||||
if (
|
||||
suppressNoDelim &&
|
||||
delim !== '' &&
|
||||
delimChar !== '' &&
|
||||
!line.includes(delimChar)
|
||||
) {
|
||||
if (suppressNoDelim && !line.includes(delimChar)) {
|
||||
continue
|
||||
}
|
||||
const cols = delim === '' ? [...line] : line.split(delimChar)
|
||||
const cols = line.split(delimChar)
|
||||
const out = []
|
||||
for (const n of [...want].sort((a, b) => a - b)) {
|
||||
out.push(cols[n - 1] != null ? cols[n - 1] : '')
|
||||
|
||||
Reference in New Issue
Block a user