aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorPridon Tetradze <[email protected]>2022-12-10 12:07:19 +0400
committerGitHub <[email protected]>2022-12-10 12:07:19 +0400
commitcb43f40f8f3c9e495f025359eed6e24a6542f47f (patch)
tree99ac12a50e997a78309d08b676b1a3d55e5d3096 /src/util
parentc7e06f35d9f4b6ac685d59de0ea7d062f520d0e0 (diff)
downloadcountryfetch-cb43f40f8f3c9e495f025359eed6e24a6542f47f.tar.xz
countryfetch-cb43f40f8f3c9e495f025359eed6e24a6542f47f.zip
add progress logger (#11)
Diffstat (limited to 'src/util')
-rw-r--r--src/util/logger.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util/logger.ts b/src/util/logger.ts
index 4df9fb7..49dcd86 100644
--- a/src/util/logger.ts
+++ b/src/util/logger.ts
@@ -18,6 +18,18 @@ export class Logger {
console.error(nano.red(data));
}
+ public progress(
+ current: number,
+ total: number,
+ config?: { title: string; description: string }
+ ) {
+ console.clear();
+ if (config?.title) {
+ this.alert(config.title);
+ }
+ console.log(`${current}/${total} ${config?.description || ""}`);
+ }
+
public logCountry(country: FetchedCountry) {
console.log(
nano.cyan("Country:"),