countries-cli

0.1.1 • Public • Published

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"
}

Package Sidebar

Install

npm i countries-cli

Weekly Downloads

3

Version

0.1.1

License

MIT

Unpacked Size

5.52 kB

Total Files

4

Last publish

Collaborators

  • jakeklassen