aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/image-converter.ts22
-rw-r--r--src/util/logger.ts30
2 files changed, 38 insertions, 14 deletions
diff --git a/src/util/image-converter.ts b/src/util/image-converter.ts
new file mode 100644
index 0000000..17d070a
--- /dev/null
+++ b/src/util/image-converter.ts
@@ -0,0 +1,22 @@
+import {
+ printImage,
+ getImageStrings,
+} from "https://x.nest.land/[email protected]/mod.ts";
+import { environment } from "../environment/environment.ts";
+
+export class ImageConverter {
+ width = environment.flagWidth;
+ public getImageStrings(path: string) {
+ return getImageStrings({
+ path,
+ width: this.width,
+ });
+ }
+
+ public printImage(path: string) {
+ return printImage({
+ path,
+ width: this.width,
+ });
+ }
+}
diff --git a/src/util/logger.ts b/src/util/logger.ts
index aaa92c5..58745b7 100644
--- a/src/util/logger.ts
+++ b/src/util/logger.ts
@@ -1,8 +1,8 @@
import * as nano from "https://deno.land/x/[email protected]/mod.ts";
-import { FetchedCountry } from "../models/FetchedCountry.model.ts";
+import { FetchedCountry } from "../models/fetched-country.model.ts";
export class Logger {
- public log(...data: any) {
+ public log(data: any) {
console.log(data);
}
@@ -15,33 +15,33 @@ export class Logger {
}
public error(...data: any) {
- console.error(data);
+ console.error(nano.red(data));
}
public logCountry(country: FetchedCountry) {
console.log(
- nano.cyan("\nCountry:\t\t"),
+ nano.cyan("Country:"),
country.country,
country.flag,
- nano.green("\nLat/Lng\t\t\t"),
+ nano.green("\nLat/Lng:"),
country.latlng,
- nano.green("\nPopulation:\t\t"),
+ nano.green("\nPopulation:"),
country.population,
- nano.green("\nLanguages:\t\t"),
+ nano.green("\nLanguages:"),
country.languages,
- nano.green("\nCapital:\t\t"),
+ nano.green("\nCapital:"),
country.capital,
- nano.green("\nCapital Lat/Lng:\t"),
+ nano.green("\nCapital Lat/Lng:"),
country.capitalLatLng,
- nano.green("\nRegion:\t\t\t"),
+ nano.green("\nRegion:"),
country.region,
- nano.green("\nSubregion:\t\t"),
+ nano.green("\nSubregion:"),
country.subregion,
- nano.green("\nTimezones:\t\t"),
+ nano.green("\nTimezones:"),
country.timezones,
- nano.green("\nTop Level Domain:\t"),
+ nano.green("\nTop Level Domain:"),
country.tld,
- nano.green("\nCurrencies:\t\t"),
+ nano.green("\nCurrencies:"),
country.currencies
);
}
@@ -63,6 +63,8 @@ export class Logger {
"\nARGS:\n",
"\tsync",
"\n\t\tSynchronize database. Stores countries' data in ~/.cache/conntryfetch/countries.json.",
+ "\n\t\tPass additional argument 'sync flag' to fetch and convert flags in ASCII art.",
+ "\n\t\tAfter syncing flags, every countryfetch command will display flag ASCII art.",
"\n",
"\n\trandom",
"\n\t\tPrint information about a random country.",