summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2021-11-13 22:05:16 +0100
committerErich Eckner <git@eckner.net>2021-11-13 22:05:16 +0100
commitd3a28c07ba52c517a44cb5d34089bf7d05d7b190 (patch)
tree3ac6052b84a48e59696f0da501de8c3da87d4255
parentb431b1d1ae221459f51c7e11049fe64e6012d13a (diff)
downloadcarddav-alpine-converter-d3a28c07ba52c517a44cb5d34089bf7d05d7b190.tar.xz
actually put UID into files
-rwxr-xr-xalpine-to-carddav16
1 files changed, 8 insertions, 8 deletions
diff --git a/alpine-to-carddav b/alpine-to-carddav
index c9338fb..0766f35 100755
--- a/alpine-to-carddav
+++ b/alpine-to-carddav
@@ -67,7 +67,7 @@ git -C "${git_dir}" diff -U0 -- addressbook \
removals=false
;;
'+'*)
- last_uid="${last_uids[${#last_uids[@]}]}"
+ newUID="${last_uids[${#last_uids[@]}]}"
mapfile -t last_uids < <(
printf '%s\n' "${last_uids[@]}" \
| sed '$d'
@@ -79,26 +79,26 @@ git -C "${git_dir}" diff -U0 -- addressbook \
date -u -Iseconds \
| sed 's@+00:00$@Z@'
)
- if [ -z "${last_uid}" ]; then
+ if [ -z "${newUID}" ]; then
if ${removals}; then
>&2 printf 'There were more addresses added than removed.\n'
exit 1
fi
- last_uid=$(uuidgen)
- printf '%s\t%s\n' "${last_uid}" "${line#+}" \
+ newUID=$(uuidgen)
+ printf '%s\t%s\n' "${newUID}" "${line#+}" \
>> "${git_dir}/uids"
- print_cnt 'new' > "${git_dir}/${last_uid}.vcs"
+ print_cnt 'new' > "${git_dir}/${newUID}.vcs"
else
read_line 'old' < <(
sed '
- s/^'"${last_uid}"'\t//
+ s/^'"${newUID}"'\t//
t
d
' "${git_dir}/uids"
)
sed -i '
- /^'"${last_uid}"'\t/ {
- i '"${last_uid}$(printf '\t')${line#+}"'
+ /^'"${newUID}"'\t/ {
+ i '"${newUID}$(printf '\t')${line#+}"'
d
}
' "${git_dir}/uids"