rust_iso3166 0.1.14

ISO 3166-1 (Codes for the representation of names of countries and their subdivisions – Part 1: Country codes) is a standard defining codes for the names of countries, dependent territories, and special areas of geographical interest. It is the first part of the ISO 3166 standard published by the International Organization for Standardization.
Documentation
#[cfg(not(target_arch = "wasm32"))]
fn main() {
  use prettytable::{row, Table};
  use std::env;

  let mut args = env::args();
  let script_name = match args.next() {
    Some(arg) => arg,
    None => String::from(""),
  };
  let query = match args.next() {
    Some(arg) => arg,
    None => String::from(""),
  };
  let query = &query.to_lowercase();

  eprintln!("Usage: {} [query]", script_name);
  let mut found = false;
  let mut table = Table::new();
  table.add_row(row!["Name", "Alpha2", "Alpha3", "Numeric"]);

  for country in rust_iso3166::ALL {
    if country.alpha2.to_lowercase().contains(query)
      || country.alpha3.to_lowercase().contains(query)
      || country.numeric_str().to_lowercase().contains(query)
    {
      table.add_row(row![
        country.name,
        country.alpha2,
        country.alpha3,
        country.numeric_str()
      ]);
      found = true;
    }
  }

  if !found {
    for country in rust_iso3166::ALL {
      if country.name.to_lowercase().contains(query) {
        table.add_row(row![
          country.name,
          country.alpha2,
          country.alpha3,
          country.numeric_str()
        ]);
      }
    }
  }
  table.printstd();
}

#[cfg(target_arch = "wasm32")]
fn main() {
  unimplemented!();
}