commit: 1d2b0d4077f0dd41b8dd33d4eb4936a502dc9beb
parent 9ab3d2a2d65dd9fb7d43cc5b16ada5ffb34441ad
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Fri, 18 Feb 2022 23:41:42 +0100
.common.sh: Add rot13 function
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/.common.sh b/.common.sh
@@ -210,6 +210,14 @@ ver_bump() {
git add "${2}/../Manifest"
}
+# Unicode-aware variant inspired by https://qntm.org/files/rot13/rot13.html
+rot13() {
+ uconv -f utf-8 -t utf-8 -x '::nfd;' \
+ | tr \
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' \
+ 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm'
+}
+
gitclone() {
url="$1"
dir=$(echo "$1" | sed -E -e 's;^(https?://|git:);'$HOME'/Sources/git/;' -e 's;.git$;;')