File indexing completed on 2024-07-21 04:36:26

0001 #!/bin/sh
0002 #
0003 # Update all kmymoney templates from gnucash accounts
0004 #
0005 # Author: Ralf Habacker <ralf.habacker@freenet.de>
0006 # 
0007 d=$(dirname $0)
0008 c=$(pwd)
0009 cd $d
0010 r=~/src/kmymoney-build/tools
0011 
0012 if test -z "$1"; then
0013     echo "kmt2txt-all <outdir>"
0014     exit 1
0015 fi
0016 
0017 xsltscript=$(realpath kmt2txt.stylesheet)
0018 in=$(realpath ../kmymoney/templates)
0019 out=$1
0020 for j in $(cd $in; find -name '*.kmt'); do
0021     i=$(echo $j | sed 's,^./,,g')
0022     p=$(dirname $i | sed 's,./,,g')
0023     f=$(basename $i | sed 's,kmt,txt,g')
0024     if ! test -d "$c/$out/$p"; then
0025         mkdir -p "$c/$out/$p"
0026     fi
0027     infile="$in/$i"
0028     outfile="$c/$out/$p/$f"
0029 #    if ! test -f "$out/$p/$f"; then
0030 #        echo "using $infile  to create template $outfile"
0031 #    else
0032 #       echo "using $infile to update $outfile"
0033 #    fi
0034     xsltproc $xsltscript $infile | sort > $outfile
0035 done