Commit 74df2f61 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig

fixup

parent 5c78c634
...@@ -68,17 +68,15 @@ export const createProgress = (total: number, label: string) => { ...@@ -68,17 +68,15 @@ export const createProgress = (total: number, label: string) => {
const isFinished = curProgress === total const isFinished = curProgress === total
const message = `${label} (${curProgress}/${total})` const message = `${label} (${curProgress}/${total})`
if (progressSpinner && !isFinished) {
progressSpinner.setText(message) progressSpinner.setText(message)
} else { if (isFinished) {
progressSpinner.setText(message) progressSpinner.stopAndPersist()
progressSpinner?.stopAndPersist()
} }
} }
const clear = () => { const clear = () => {
if ( if (
progressSpinner && process.stdout.isTTY &&
// Ensure only reset and clear once to avoid set operation overflow in ora // Ensure only reset and clear once to avoid set operation overflow in ora
progressSpinner.isSpinning progressSpinner.isSpinning
) { ) {
......
...@@ -80,7 +80,8 @@ export default function createSpinner( ...@@ -80,7 +80,8 @@ export default function createSpinner(
} }
return spinner return spinner
} else { } else {
logFn(prefixText ? prefixText + '...' : text) text = ` ${Log.prefixes.info} ${text} `
logFn(text)
// @ts-ignore // @ts-ignore
let spinner = { let spinner = {
...@@ -89,14 +90,13 @@ export default function createSpinner( ...@@ -89,14 +90,13 @@ export default function createSpinner(
text: '', text: '',
clear: '', clear: '',
setText(newText: string) { setText(newText: string) {
logFn(` ${Log.prefixes.info} ${newText} `) text = ` ${Log.prefixes.info} ${newText}`
logFn(text)
}, },
stop: () => spinner, stop: () => spinner,
stopAndPersist: () => { stopAndPersist: () => {
const duration = process.hrtime.bigint() - progressStart const duration = process.hrtime.bigint() - progressStart
logFn( logFn(`${text} in ${hrtimeBigIntDurationToString(duration)}`)
` ${Log.prefixes.event} ${text} in ${hrtimeBigIntDurationToString(duration)}`
)
return spinner! return spinner!
}, },
} as ora.Ora & { setText: (text: string) => void } } as ora.Ora & { setText: (text: string) => void }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment