1
0
mirror of https://git.sr.ht/~cadence/bibliogram synced 2024-11-22 08:07:30 +00:00

Database upgrade code does not require a tty

This commit is contained in:
Cadence Ember 2020-05-31 17:49:27 +12:00
parent f252233f47
commit f37d5bade3
No known key found for this signature in database
GPG Key ID: 128B99B1B74A6412

View File

@ -110,11 +110,16 @@ function writeProgress(i) {
const size = deltas.size
const progress = "=".repeat(i) + " ".repeat(deltas.size-i)
const numberLength = String(deltas.size).length
process.stdout.cursorTo(0)
if (process.stdout.isTTY) {
process.stdout.cursorTo(0)
}
process.stdout.write(
`Creating database... (${String(i).padStart(numberLength, " ")}`
+`/${String(size).padStart(numberLength, " ")}) [${progress}]`
)
if (!process.stdout.isTTY) {
process.stdout.write("\n")
}
}
async function createBackup(entry) {