From 554a7ae6d020d414f19b7f7c8edd6c812774fcd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Nogueira?= Date: Thu, 30 Jun 2022 17:05:38 -0300 Subject: [PATCH] Add new scripts. - add iso-country-language-codes --- utils/.local/bin/iso-country-language-codes | 533 ++++++++++++++++++++ 1 file changed, 533 insertions(+) create mode 100755 utils/.local/bin/iso-country-language-codes diff --git a/utils/.local/bin/iso-country-language-codes b/utils/.local/bin/iso-country-language-codes new file mode 100755 index 0000000..b59295a --- /dev/null +++ b/utils/.local/bin/iso-country-language-codes @@ -0,0 +1,533 @@ +#!/bin/sh + +alpha=2 +db=country +while getopts :23cl opt; do + case $opt in + 2) alpha=2 ;; + 3) alpha=3 ;; + c) db=country ;; + l) db=language ;; + ?) echo "what? '$OPTARG' is unknown" + exit 1 ;; + esac +done +shift $(($OPTIND - 1)) + +alpha_value="$1" +language="${2:-en}" + +if [ $db = country ]; then + +if [ $alpha = 2 ]; then + field=alpha2 +else + field=alpha3 +fi + +# list taken from https://github.com/stefangabos/world_countries/blob/2.5.1/data/countries/_combined/world.json +cat <