]> git.plutz.net Git - serve0/blobdiff - multitag.sh
enable exclusive tags
[serve0] / multitag.sh
index 8b60adebb1ac8e265866f00570c47d124c0ca9e3..20b39391f9db1a9c103cda521c8ac145df334e33 100644 (file)
@@ -17,13 +17,18 @@ for select in $(seq 1 $(POST_COUNT select)); do
   read -r length width height tags comment fn <<-EOF
        $(meta_info "$file")
        EOF
-  tags="$(UNSTRING "${tags#tags=}" |tr , '\n')"
 
   if [ ! "$deltags" ]; then
+    extags="$(printf '%s' "$newtags" |tr , '\n' |grep -e "^-" |cut -d: -f1 )"
+    tags="$(UNSTRING "${tags#tags=}" |tr , '\n' |grep -vwFe "$extags")"
+    if printf %s "$extags" |grep -vq :; then
+      tags="$(printf %s\\n "$tags" |grep -vE '^-[^:]+$')"
+    fi
     tags="$(printf '%s\n' "${tags},${newtags}" \
             | tr , '\n' |sort -u |tr '\n' , \
             | STRING)"
   else
+    tags="$(UNSTRING "${tags#tags=}" |tr , '\n')"
     detag="${deltags},"; while [ "$detag" ]; do
       tags="$(printf '%s\n' "$tags" |grep -vxFe "${detag%%,*}")"
       detag="${detag#*,}"