make progress report on a separate line to avoid fighting with command for current line.

This commit is contained in:
Matthieu Jolimaitre 2025-08-01 10:10:57 +02:00
parent 155027fc9b
commit 669b9ac56a
2 changed files with 7 additions and 2 deletions

2
package/deploy Normal file → Executable file
View file

@ -2,5 +2,7 @@
set -e
cd "$(dirname "$(realpath "$0")")"
rm -fr release/tmp
./release/package
rm -fr aur/tmp
./aur/package

View file

@ -5,7 +5,7 @@ import { Command } from "https://deno.land/x/cliffy@v1.0.0-rc.4/command/mod.ts"
import { Channel, Constructible, InstanceOf } from "https://git.barnulf.net/mb/barnulf_ts/raw/branch/master/mod.ts"
import { wait } from "https://git.barnulf.net/mb/barnulf_ts/raw/branch/master/src/lib/utils.ts"
const version = "1.1.0"
const version = "1.1.1"
async function main() {
const { do_clear, command, extensions, files, strategy, go_up, show_progress } = await parse_args()
@ -123,6 +123,7 @@ class Runner {
if (this.go_up) this.restore_cursor()
if (stop !== undefined) stop.stop = true
log("terminated", `${secs} s`)
console.log("\x1b[2K\x1bM")
}
}
@ -143,7 +144,9 @@ class Runner {
const secs = (Math.floor(step.ms / 100) / 10).toString().padStart(3)
const total = Math.floor(this.time_estimation_ms / 1_000).toString().padStart(3)
const perc = (Math.floor(step.relative * 1_000) / 10).toString().padStart(5)
log("progress", `${secs} s / ${total} s (${perc} %)\x1bM`)
console.log("")
log("progress", `${secs} s / ${total} s (${perc} %)`)
console.log("\x1bM\x1bM\x1bM")
}
})()