aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpridon <[email protected]>2022-06-24 19:30:47 +0400
committerpridon <[email protected]>2022-06-24 19:30:47 +0400
commit8626e2d8e258e11837d27a1e99ef3277e7dfdf3b (patch)
tree930adb4c070108adbe709b395959462983da12be
parentd8a686e743f51b20d34bf86d176c1bc1bc8f2e3c (diff)
downloadcountryfetch-8626e2d8e258e11837d27a1e99ef3277e7dfdf3b.tar.xz
countryfetch-8626e2d8e258e11837d27a1e99ef3277e7dfdf3b.zip
add top level domain, increase tabularization
-rw-r--r--README.md21
-rw-r--r--src/countries.ts5
-rw-r--r--src/environment/environment.ts2
-rw-r--r--src/models/FetchedCountry.model.ts1
-rw-r--r--src/models/country.model.ts1
-rw-r--r--src/util/logger.ts22
6 files changed, 29 insertions, 23 deletions
diff --git a/README.md b/README.md
index 005f59e..ef39e6e 100644
--- a/README.md
+++ b/README.md
@@ -57,16 +57,17 @@ countryfetch <arguments>
```
$ countryfetch germany
-Country: Germany 🇩🇪
-Lat/Lng 51/9
-Population: 83,240,525
-Languages: German
-Capital: Berlin
-Capital Lat/Lng: 52.52/13.4
-Region: Europe
-Subregion: Western Europe
-Timezones: UTC+01:00
-Currencies: Euro [€](EUR)
+Country: Germany 🇩🇪
+Lat/Lng 51/9
+Population: 83,240,525
+Languages: German
+Capital: Berlin
+Capital Lat/Lng: 52.52/13.4
+Region: Europe
+Subregion: Western Europe
+Timezones: UTC+01:00
+Top Level Domain: .de
+Currencies: Euro [€](EUR)
```
diff --git a/src/countries.ts b/src/countries.ts
index 4b0a0c9..974edec 100644
--- a/src/countries.ts
+++ b/src/countries.ts
@@ -108,7 +108,8 @@ export class Countries {
region: country.region,
subregion: country.subregion,
capitalLatLng: country.capitalInfo.latlng.join("/"),
- timezones: country.timezones.join("\n\t\t "),
+ timezones: country.timezones.join("\n\t\t\t "),
+ tld: country.tld.join(" | "),
currencies,
languages,
});
@@ -134,7 +135,7 @@ export class Countries {
const currency = currencies[currencyAbbr];
result.push(`${currency.name} [${currency.symbol}](${currencyAbbr})`);
}
- return result.join("\n\t\t ");
+ return result.join("\n\t\t\t ");
}
private extractLanguages(languages: Languages) {
diff --git a/src/environment/environment.ts b/src/environment/environment.ts
index 479de91..ef48c3d 100644
--- a/src/environment/environment.ts
+++ b/src/environment/environment.ts
@@ -6,5 +6,5 @@ export const environment = {
syncInterval: 7,
cacheDir: join(home_dir() as string, ".cache", "countryfetch"),
queries:
- "all?fields=name,capital,currencies,population,flag,languages,region,subregion,timezones,latlng,capitalInfo",
+ "all?fields=name,capital,currencies,population,flag,languages,region,subregion,timezones,latlng,capitalInfo,tld",
};
diff --git a/src/models/FetchedCountry.model.ts b/src/models/FetchedCountry.model.ts
index af80281..a53482e 100644
--- a/src/models/FetchedCountry.model.ts
+++ b/src/models/FetchedCountry.model.ts
@@ -10,4 +10,5 @@ export interface FetchedCountry {
population: string;
currencies: string;
timezones: string;
+ tld: string;
}
diff --git a/src/models/country.model.ts b/src/models/country.model.ts
index 7866187..61e0dfc 100644
--- a/src/models/country.model.ts
+++ b/src/models/country.model.ts
@@ -34,4 +34,5 @@ export interface Country {
capitalInfo: {
latlng: number[];
};
+ tld: string[];
}
diff --git a/src/util/logger.ts b/src/util/logger.ts
index bfbffbf..aaa92c5 100644
--- a/src/util/logger.ts
+++ b/src/util/logger.ts
@@ -20,26 +20,28 @@ export class Logger {
public logCountry(country: FetchedCountry) {
console.log(
- nano.cyan("\nCountry:\t"),
+ nano.cyan("\nCountry:\t\t"),
country.country,
country.flag,
- nano.green("\nLat/Lng\t\t"),
+ nano.green("\nLat/Lng\t\t\t"),
country.latlng,
- nano.green("\nPopulation:\t"),
+ nano.green("\nPopulation:\t\t"),
country.population,
- nano.green("\nLanguages:\t"),
+ nano.green("\nLanguages:\t\t"),
country.languages,
- nano.green("\nCapital:\t"),
+ nano.green("\nCapital:\t\t"),
country.capital,
- nano.green("\nCapital Lat/Lng:"),
+ nano.green("\nCapital Lat/Lng:\t"),
country.capitalLatLng,
- nano.green("\nRegion:\t\t"),
+ nano.green("\nRegion:\t\t\t"),
country.region,
- nano.green("\nSubregion:\t"),
+ nano.green("\nSubregion:\t\t"),
country.subregion,
- nano.green("\nTimezones:\t"),
+ nano.green("\nTimezones:\t\t"),
country.timezones,
- nano.green("\nCurrencies:\t"),
+ nano.green("\nTop Level Domain:\t"),
+ country.tld,
+ nano.green("\nCurrencies:\t\t"),
country.currencies
);
}