0.1.1 • Published 6 years ago

countries-cli v0.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

countries-cli Build Status

Query country information from the country-data npm package.

Install

$ npm i -g countries-cli

Or for one-time run:

$ npx countries-cli

Usage

countries-cli responds with a formatted JSON array by default if the process doesn't fail:

$ countries-cli --name canada
[
  {
    alpha2: "CA",
    alpha3: "CAN",
    countryCallingCodes: ["+1"],
    currencies: ["CAD"],
    emoji: "🇨🇦",
    ioc: "CAN",
    languages: ["eng", "fra"],
    name: "Canada",
    status: "assigned"
  }
]

When nothing is found:

$ countries-cli --name whoops
[]

If you want an unformatted JSON string as output, use --no-pretty:

$ countries-cli --name canada --no-pretty
[{"alpha2":"CA","alpha3":"CAN","countryCallingCodes":["+1"],"currencies":["CAD"],"emoji":"🇨🇦","ioc":"CAN","languages":["eng","fra"],"name":"Canada","status":"assigned"}]

This is useful when using a tool like jq where the colorized format will fail to parse:

$ countries-cli --name canada --no-pretty | jq '.[] | { name: .name }'
{
  "name": "Canada"
}