A cli tool for fetching information about countries.

Overview

countryfetch

A cli tool for fetching information about countries. It uses https://restcountries.com/ API for backend.

Dependencies

DENO

Installation

Default Way

clone this repository:

git clone https://github.com/CondensedMilk7/countryfetch.git

navigate to the cloned repo folder and run install:

cd ./countryfetch
./install.sh

The app should now be installed. This method should work for most users.

Another Way

alternatively, you can compile it yourself and store it in your local bin directory:

deno compile --allow-all index.ts
cp ./countryfetch  ~/.local/bin

If after this your shell cannot find countryfetch, this means you haven't added your local bin to PATH. Either add it to PATH, or make an alias in your .bashrc or .zshrc:

alias countryfetch="~/.local/bin/countryfetch"

Note: The executable you get from compilation can be stored and accessed from anywhere. Using the default way (install.sh), the installer simply runs deno install --allow-all and stores the executable in ~/.deno/bin/, which (if you have installed deno) should already be added to PATH, therefore you don't need any aliases. Your shell should be able to detect the command countryfetch.

Usage

countryfetch <arguments>

Arguments:

  • <country_name> - Find country information by name.
  • capital <capital> - Find country to which the specified capital belongs.
  • sync - Fetches data from API and stores it in ~/.cache/countryfetch/countries.json. This is done automatically, but can be triggered manually. Pass additional argument sync flag to fetch and convert flags in ASCII art. After syncing flags, every countryfetch command will display flag ASCII art.
  • random - Get random country information.
  • raw - Print country information in raw format as JavaScript object.

Example:

$ 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
Top Level Domain: .de
Currencies: Euro [€](EUR)

Flag ASCII Art

terminal_images library is used for image conversion. If you like my project, you should star this project as well. Maybe contribute and help the author too!

To enable displaying ASCII art, run countryfetch sync flags. This may take a minute, depending on your network connection, as the program fetches every flag image from countries data, converts them into ASCII art and stores them in "~/.cache/countryfetch/flags.json". This library uses the unstable version of Deno, therefore if you get an error like "X is not a function" you should try passing the --unstable flag. Due to this, consistency is not guaranteed.

If for some reason you no longer want to display ASCII art, simply delete the flags.json in cache:

rm ~/.cache/countryfetch/flags.json

Troubleshooting

If you get an error after installing the newer version of the program, such as "cannot read properties of undefined", you might have an outdated cache. Try running countryfetch sync to update the cache.

Would be nice to have in the future (a bit ambitious):

  • Display country flag in ASCII format (like in neofetch).
  • Better arguments and options passing/handling.
  • Users can customize which information to display about country.
  • Get only one particular property about country (for example, get just the timezone of Netherlands).
  • Custom query builder that makes a direct call to api and returns a readable information.
  • A capital guessing game.

Contribution

I will add new features when I have time, but you don't have to wait - add them yourself! Submit pull requests, or fork it and make it your own alltogether.

Comments
  • Countryfetch don't start

    Countryfetch don't start

    Hi, I test countryfetch with manjaro kde and I have a problem, countryfetch don't start. Problem of path ?

    Steps :

    Install deno Follow the instruction Integrate path

    Result : Screenshot_20220626_102826

    Can you help me ? Thks

    opened by sebastien-cupin 9
  • Tiny flags appearing as empty squares

    Tiny flags appearing as empty squares

    Hey, love the program but I am having a strange issue. It will not display the tiny flag but the ascii one is displayed no issues. Example attached below. Screenshot_20220627_161244

    �Thanks for the neat terminal candy!

    opened by xi-pinmping 5
  • `countryfetch india` gives info about British Indian Ocean Territory

    `countryfetch india` gives info about British Indian Ocean Territory

    https://restcountries.com/v3.1/name/India returns info both about the BIOT and India. BIOT is first so I assume that's why it takes this info.

    Adding ?fullText=true seems to resolve the issue.

    opened by wojwesoly 4
  • error: Uncaught TypeError: Cannot read properties of undefined (reading 'join')

    error: Uncaught TypeError: Cannot read properties of undefined (reading 'join')

    I installed it as it says in the README.md.

    And it gave me that error:

    error: Uncaught TypeError: Cannot read properties of undefined (reading 'join')
                latlng: country.latlng.join("/"),
                                       ^
        at Countries.print (file:///home/paij0se/countryfetch/src/countries.ts:88:36)
        at App.run (file:///home/paij0se/countryfetch/src/app.ts:34:38)
        at async file:///home/paij0se/countryfetch/index.ts:2:1
    

    Note: i was using ssh on a Windows pc connected to a Ubuntu pc, and the previous version worked fine.

    opened by paij0se 1
  • Unable to view the flag of the country that I have used countryfetch on.

    Unable to view the flag of the country that I have used countryfetch on.

    Only happens within the terminal if I copy text out of terminal flag shows normally. Is this due to not having a font installed. I use Jetbrains mono nerd font currently.

    Sorry for the inconvenience.

    opened by tpratty 0
Releases(v.1.0.0)
Owner
Pridon Tetradze
Pridon Tetradze
Country finder: A site that allows you to browse the countries of the world with all the necessary information about the country

Country finder: A site that allows you to browse the countries of the world with all the necessary information about the country

Medjahdi Islem 12 Nov 18, 2022
This is our second school project in HTML 5, CSS 3 and JS. In this website you can find very interesting information about the countries around the world.

Team Geonomy ?? About This is a website about with interatcive map and very interesting information about different coutries ??️ Used technologies Use

Stanislav Tashev 33 Nov 23, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Simple weather app written in HTML, CSS, and JavaScript using the OpenWeather API for fetching weather and geolocation information

Description Simple weather app written in HTML, CSS, and JavaScript using the OpenWeather API for fetching weather and geolocation information. Acknow

Gleb Korzan 4 Feb 23, 2022
A crawler that crawls the site's internal links, fetching information of interest to any SEO specialist to perform appropriate analysis on the site.

Overview ?? It is a module that crawls sites and extracts basic information on any web page of interest to site owners in general, and SEO specialists

Yazan Zoghbi 2 Apr 22, 2022
A crawler that crawls the site's internal links, fetching information of interest to any SEO specialist to perform appropriate analysis on the site.

Overview ?? It is a module that crawls sites and extracts basic information on any web page of interest to site owners in general, and SEO specialists

Yazan Zoghbi 2 Apr 22, 2022
A CLI tool to create a NodeJS project with TypeScript CTSP is a CLI tool to make easier to start a new NodeJS project and configure Typescript on it.

CTSP- Create TS Project A CLI tool to create a NodeJS project with TypeScript CTSP is a CLI tool to make easier to start a new NodeJS project and conf

Jean Rodríguez 7 Sep 13, 2022
A mobile web application to check the data on the total covid19 confirmed cases and deaths, check data for all countries with recorded cases.

This is a mobile web application to check the data on the total covid19 confirmed cases and deaths, check data for all countries with recorded cases. It also has a details page to check for the statistics for each region/state if available.

Solomon Hagan 7 Jul 30, 2022
Weather Condition App is a mobile application that has a category of countries in the home age and the users can access to weather of each country.

World Weather This is a SPA react-app project that is built using two APIs. And users can select and choose countries and states and get their updated

Ahmad Zamir Yousufi 2 Oct 10, 2022
The Main Purpose The main purpose of creating an anaonline information system, as an effort responsive to the management of the data of the Members of the Persis Youth based on information technology systems

landing-page-pp landing-page-pp.vercel.app #The Main Purpose The main purpose of creating an anaonline information system, as an effort responsive to

Hilman Firdaus 6 Oct 21, 2022
A Cloudflare Worker for fetching data from Twitter User API.

cloudflare-worker-twitter This is a Cloudflare Worker for fetching data from Twitter User API. ❔ About this project I created this Worker to hide my A

Arda Soytürk 12 Oct 1, 2022
Wen? Now! A library to simplify your Web3 data fetching.

Wen Connect? Now! Minimalistic library for Web3 user interfaces. Seamless connection flows to Metamask. Stateless sessions that work anywhere (client,

Guillaume Bibeau-laviolette 20 Jul 20, 2022
An even simpler wrapper around native Fetch to strip boilerplate from your fetching code!

Super lightweight (~450 bytes) wrapper to simplify native fetch calls using any HTTP method (existing or imagined). Features Fully typed/TypeScript su

Kevin R. Whitley 49 Dec 28, 2022
A JavaScript library for EASILY fetching info from TheMovieDB API with support for torrent file names.

TheMovieDB-API-Wrapper.js A easy to use, pure vanilla JavaScript API wrapper for TheMovieDB Show your support! A JavaScript library for easily fetchin

Marketing Pipeline 5 Dec 2, 2022
Node-cli-starter - Basic starter kit for building Node CLI applications with TypeScript.

node-cli-starter Minimal starter kit for building Node CLI applications with TypeScript. Getting Started To get started clone repo locally and run npm

Cory Rylan 7 May 17, 2022
Serverless boilerplate CLI tool: GitLab and GitHub CI/CD, DataDog, Multi-Region, and many more setups.

Serverless Full Boilerplate This is a CLI tool to create Serverless boilerplate applications. Ready to deploy in a few seconds. Usage npm i -g create-

Emin Buğra Saral 9 Nov 7, 2022
Strcmp-node - A cli string comparison tool, because apparently one doesn't exist.

strcmp-node I couldn't find a string comparison command, so i made my own. its probably the ugliest thing since godzilla with makeup on, but it works.

Gingka/Ginger Pepper 1 Jan 1, 2022