Innovenergy_trunk/csharp/Lib/Units/Generator/generate.sh

15 lines
378 B
Bash
Executable File

#!/usr/bin/env bash
scriptDir=$( dirname -- "$0"; )
cd "$scriptDir/.." || exit
for match in $(grep -e '\[Generate\]' -o *.cs | tr -d '[]')
do
path="${match%:*}"
type="${match#*:}"
file=$(basename -- "$path")
class="${file%.*}"
echo "generating $file"
sed "s/Template/$class/g; s/AggregationType/$type/g" "./Generator/Template.txt" > "./$class.generated.cs"
done