simplify output for non-TTY

master
Conduitry 3 months ago
parent 988b49b9ae
commit 5e5b2fca96
  1. 10
      _shared.js

@ -35,9 +35,15 @@ export const dl = async get_posts => {
const query = get_query(arg);
for await (const page of get_posts(query)) {
posts.push(...page);
console.log(`\x1b[K${query}: ${posts.length} posts\x1b[A`);
if (process.stdout.isTTY) {
console.log(`\x1b[K${query}: ${posts.length} posts\x1b[A`);
}
}
if (process.stdout.isTTY) {
console.log();
} else {
console.log(`${query}: ${posts.length} posts`);
}
console.log();
for (let i = 0; i < posts.length; i++) {
const { url, dest, date } = posts[i];

Loading…
Cancel
Save