#!/bin/bash

# Auto-increment development version number
VERSION_FILE="include/main.h"
CURRENT_VERSION=$(grep "MICE_VERSION" "$VERSION_FILE" | sed -n 's/.*"dev\([0-9]*\)".*/\1/p')

if [ -z "$CURRENT_VERSION" ]; then
    echo "Could not find version number, starting at dev1"
    NEW_VERSION=1
else
    NEW_VERSION=$((CURRENT_VERSION + 1))
fi

echo "Incrementing version: dev$CURRENT_VERSION -> dev$NEW_VERSION"

# Update the version in the header file
sed -i "s/dev[0-9]*/dev$NEW_VERSION/g" "$VERSION_FILE"

echo "Version updated to dev$NEW_VERSION"