🌳
pt0/deployF/cliF/cliProgressAI.mts
1// Single-line CLI progress logger (awaitrollout-style output)
2// Usage: const log = mkProgressLogger('kaniko build-123', timeoutMs); log('Pending'); log('Running'); log('done')
3// Output: kaniko build-123 Pending . Running .. done
7const showTimeouts = false // set true to display [timeout Xm] inline
9export const mkProgressLogger = (prefix: string, timeoutMs?: number) => {
10 let lastStatus = ''
11 const timeoutStr = (timeoutMs && showTimeouts) ? ` [timeout ${fmtDuration(Math.round(timeoutMs/1000), false)}]` : ''
12 process.stdout.write(fmtElapsed() + prefix + timeoutStr)
13 return (status: string) => {
14 if (status === lastStatus) {
15 process.stdout.write('.')
16 } else {
17 process.stdout.write(` ${status}`)
18 lastStatus = status
19 }
20 }