nur-packages

My NUR packages
git clone git://git.sikmir.ru/nur-packages
Log | Files | Refs | README | LICENSE

upsert-tag.sh (399B)


      1 function upsertTag() {
      2   key=$1
      3   value=$2
      4   cfgfile=$3
      5 
      6   if [ -f $cfgfile ]; then
      7     $DRY_RUN_CMD xml ed -P -L \
      8       -N N="http://josm.openstreetmap.de/preferences-1.0" \
      9       -d "//N:tag[@key='$key']" \
     10       -s '/N:preferences' -t elem -n "tag" \
     11       -i '$prev' -t attr -n "key" -v "$key" \
     12       -a "/N:preferences/tag[@key='$key']" -t attr -n "value" -v "$value" \
     13       $cfgfile
     14   fi
     15 }