#!/bin/bash
set -e

sourceDir=$(dirname "$0")/..
gitDir="$sourceDir/.git"

if [ -d "$gitDir" ]; then
	git --git-dir "$gitDir" describe --always
	exit 0
fi

while read -r line; do
	if [[ $line = VERSION* ]]; then
		echo "$line" | sed 's/VERSION\s*=\s*//' | sed 's/"//g'
		exit 0
	fi
done <"$sourceDir/pyglossary/core.py"
