if [ "$1" = "install" ]; then
if hash realpath; then
source="$(realpath "$0")"
else
p="$(cd "$(dirname "$0")"; pwd)"
f="$(basename "$0")"
source="$p/$f"
fi
target="$(git rev-parse --git-dir 2>/dev/null)"/hooks/pre-commit
[ -f "$target" ] || ln -s "$source" "$target"
exit
fi
cargo run -p aasvg-cli -- example.txt > example.svg 2>/dev/null
for f in tests/conformance/*.txt; do
name=$(basename "$f" .txt)
cargo run -p aasvg-cli -- "$f" > "tests/conformance/${name}.rust.svg" 2>/dev/null
done
git add example.svg tests/conformance/*.rust.svg 2>/dev/null
cargo test