From 9b95fa13e73a42e01db91566f83a0caad26db0a9 Mon Sep 17 00:00:00 2001 From: vv01f Date: Sun, 17 Nov 2019 12:35:27 +0100 Subject: [PATCH] add international country names --- dhl.sh | 49 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/dhl.sh b/dhl.sh index 773afa1..c7b0aed 100755 --- a/dhl.sh +++ b/dhl.sh @@ -99,14 +99,14 @@ iso3countrycode () { echo "argument missing. ($0)" else case "$1" in - Belgien) echo "BEL";; - Deutschland) echo "DEU";; - England) echo "GBR";; + Belgien|Belgium|Belgique) echo "BEL";; + Deutschland|Germany|Allemagne) echo "DEU";; + England|Great\ Britain|United\ Kingdom|Scotland|Wales|North\ Ireland) echo "GBR";; Luxemburg|Luxembourg) echo "LUX";; - Niederlande) echo "NLD";; - Österreich) echo "AUT";; - Schweiz) echo "CHE";; - Ungarn) echo "HUN";; + Niederlande|Netherlands) echo "NLD";; + Österreich|Austria|Autriche) echo "AUT";; + Schweiz|Switzerland|Suisse) echo "CHE";; + Ungarn|Hungaria) echo "HUN";; *) echo "unknown country: $1";exit 1;; esac fi @@ -114,14 +114,14 @@ iso3countrycode () { testiso3 () { # covering data in https://doku.ccc.de/index.php?title=Attribut:Chaostreff-Country&limit=500&offset=0 - testcmp "BEL" "iso3countrycode" "Belgien" - testcmp "DEU" "iso3countrycode" "Deutschland" - testcmp "GBR" "iso3countrycode" "England" + testcmp "BEL" "iso3countrycode" "Belgien" "Belgium" "Belgique" + testcmp "DEU" "iso3countrycode" "Deutschland" "Germany" "Allemagne" + testcmp "GBR" "iso3countrycode" "England" "Great Britain" "United Kingdom" "Scotland" "Wales" "North Ireland" testcmp "LUX" "iso3countrycode" "Luxembourg" "Luxemburg" - testcmp "NLD" "iso3countrycode" "Niederlande" - testcmp "AUT" "iso3countrycode" "Österreich" - testcmp "HUN" "iso3countrycode" "Ungarn" - testcmp "CHE" "iso3countrycode" "Schweiz" + testcmp "NLD" "iso3countrycode" "Niederlande" "Netherlands" + testcmp "AUT" "iso3countrycode" "Österreich" "Austria" "Autriche" + testcmp "HUN" "iso3countrycode" "Ungarn" "Hungaria" + testcmp "CHE" "iso3countrycode" "Schweiz" "Switzerland" "Suisse" testcmp "" "iso3countrycode" "Simbabwe" # should fail } @@ -141,6 +141,27 @@ testconvnl () { testcmp "$tn2" "convnl" "$tn1" "$tn2" && rm "$tn2" } +getauth () { + # Zugangsdaten für das Mediawiki aus Konfiguratonsdatei bzw. ggf. + user="" + pass="" + test -f ds.conf && { + user=$(cat ds.conf|grep -i "^user="|cut -d= -f2) # + pass=$(cat ds.conf|grep -i "^pass="|cut -d= -f2) # + } || { + which pass 2>/dev/null && { + passfile="$(cat ds.conf|grep -i "^passfile="|cut -d= -f2)" # ccc/doku-htaccess + passstore="$(cat ds.conf|grep -i "^passstore="|cut -d= -f2)" # ~/.password-store/ + test -f ${passstore}${passfile} || { >&2 echo "path for password manager does not match: "${passfile}; exit 1; } + user=$(pass ${passfile} |grep -i "^login "|rev|cut -d" " -f1|rev) + pass=$(pass ${passfile} |head -1) + } || { >&2 echo "tool missing: pass (unix password manager)"; exit 1; } + } + test "$user" = "" && { >&2 echo "no auth data found."; exit 1; } + echo "${user}:${pass}" +} + + runtests () { testchklength teststringcrop