#!/bin/bash
#
# vim:tabstop=3:expandtab:shiftwidth=3
#

_help_show_args="[gsettings-list-recursively-file] [file2]"
if [ -f $(dirname $0)/_option_processor ]
then
   . $(dirname $0)/_option_processor
fi

if [ $# -eq 0 ]
then
   set -- /dev/stdin
fi

while [ $# -ne 0 ]
do
   if [ ! -e $1 ]
   then
      echo "## File $1 not found"
   else
      echo "## loading from file $1" | sed 's,file /dev/\(.*\),(\1),'
      sed 's/#.*//g' $1 | grep -v '^[[:space:]]*$' | \
      sed -e 's/[[:space:]][[:space:]]*/:/' | \
      while read Line
      do
         K="$(echo "$Line" | awk -F: '{print $1}')"
         V="$(echo "$Line" | awk -F: '{print $2}')"
         echo "# dconf write $K $V"
         dconf write $K "$V"
      done
   fi
   shift
done

