1
0
mirror of https://github.com/mfontanini/presenterm.git synced 2026-09-01 23:33:21 -06:00

Try to make changelog script work on mac

This commit is contained in:
Matias Fontanini 2024-01-31 11:13:58 -08:00
parent 2cdc1bcfdb
commit 5c8b62b101

View File

@ -2,16 +2,25 @@
set -e
script_dir=$(dirname "$0")
root_dir=$(realpath "${script_dir}/../")
if [ $# -ne 1 ]; then
echo "Usage: $0 <version>"
exit 1
fi
version=$1
changelog="${root_dir}/CHANGELOG.md"
if ! grep "^# ${version}" CHANGELOG.md >/dev/null; then
if ! grep "^# ${version}" "$changelog" >/dev/null; then
echo "Version ${version} not found in changelog"
exit 1
fi
sed -n "/^# ${version}/,/^# /{/^# ${version}/p;/^# /b;p}" CHANGELOG.md
releases=$(grep -e "^# " -n "$changelog")
version_line=$(echo "$releases" | grep "$version" | cut -d : -f 1)
next_line=$(echo "$releases" | grep -v "$version" -m 1 | cut -d : -f 1)
let next_line=("$next_line" - 1)
sed -n "${version_line},${next_line}p" "$changelog"