add international country names

This commit is contained in:
vv01f 2019-11-17 12:35:27 +01:00
parent 45694306b6
commit 9b95fa13e7
Signed by untrusted user who does not match committer: vv01f
GPG Key ID: 02625A16AC1D1FF6
1 changed files with 35 additions and 14 deletions

49
dhl.sh
View File

@ -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