#!/bin/bash
SOURCE="$0"
source /usr/lib/elive-tools/functions
#EL_REPORTS="1"
#el_make_environment


eet_conf_unpack_all_files(){
    find . -mindepth 1 -maxdepth 1 -type f -iname '*'.cfg -exec eet -d {} config {}.src \;
}

main(){
    # pre {{{
    local conf

    if ! el_check_variables "E_CONF_PROFILE" ; then
        el_error "E_CONF_PROFILE variable is not set, it should point to 'standard' but it should be already set if you are previously in an E environment"
        exit 1
    fi

    if [ -n "$E_START" ] && [ -z "$E_HOME_DIR" ] ; then
        E_HOME_DIR="$HOME/.e/e17"
    fi

    # }}}

    cd "$E_HOME_DIR/config/$E_CONF_PROFILE"

    enlightenment_remote -save
    sync

    eet_conf_unpack_all_files

    el_explain 0 "First run, saving a backup to compare later"
    bkp remove
    bkp save

    while true
    do
        el_explain 0 "Done, change configurations and press Enter to compare"
        read nothing

        enlightenment_remote -save
        sync ; LC_ALL=C sleep 0.3
        eet_conf_unpack_all_files

        el_explain 0 "Comparing with meld..."

        bkp meld

        el_explain 0 "Saving a new snapshot..."
        bkp save
    done

}

#
#  MAIN
#
main "$@"

# vim: set foldmethod=marker :
