summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2021-11-13 11:15:29 +0100
committerErich Eckner <git@eckner.net>2021-11-13 11:15:37 +0100
commita6b4d01228cc8dd76b672b4a1d9e7c5a499a9735 (patch)
tree2d59b8bc248f305d1b9c726ece932b5741517f6e
parentd1a4727ba0dedcd32543f266edd826815e073f91 (diff)
downloadcarddav-alpine-converter-a6b4d01228cc8dd76b672b4a1d9e7c5a499a9735.tar.xz
refactor
-rwxr-xr-xcarddav-to-alpine17
1 files changed, 11 insertions, 6 deletions
diff --git a/carddav-to-alpine b/carddav-to-alpine
index d6310b2..4ed3550 100755
--- a/carddav-to-alpine
+++ b/carddav-to-alpine
@@ -20,8 +20,8 @@ find "${git_dir}" \
-type f \
-name '*.vcs' \
-printf '%p\n' \
-| while read -r f; do
- uid="${f##*/}"
+| while read -r address_file; do
+ uid="${address_file##*/}"
uid="${uid%.vcs}"
for key in "${keys[@]}"; do
@@ -35,16 +35,20 @@ find "${git_dir}" \
s@\t@ @g
s@\r$@@
/^BEGIN:VCARD$/,/END:VCARD$/ {
- /^\('"$(printf '%s\\|' "${keys[@]}" | sed 's@\\|$@@')"'\):/ {
+ /^\('"$(
+ printf '%s\\|' "${keys[@]}" \
+ | sed 's@\\|$@@'
+ )"'\):/ {
s@:@ @
p
}
}
- ' "$f"
+ ' "${address_file}"
)
if [ "${_UID}" != "${uid}" ]; then
- >&2 printf 'uids differ: "%s" != "%s"\n' "${uid}" "${_UID}"
+ >&2 printf 'uids differ in %s: "%s" != "%s"\n' \
+ "${address_file##*/}" "${uid}" "${_UID}"
error=1
continue
fi
@@ -58,7 +62,8 @@ find "${git_dir}" \
"${_COMMENT}" \
| sed '
s@\t\+$@\n@
- ' >>"${git_dir}"'/uids'
+ ' \
+ >>"${git_dir}"'/uids'
done
sed '