"""
Explicitly set the version.
"""

import logging
from tools.process import run_shell_command

LOGGER = logging.getLogger(__name__)


def bump(new_version: str, dry_run: bool = False) -> None:
    """
    Update the version in files using bumpver.

    Args:
        new_version (str): The new version to explicitly set.
        dry_run (bool): If True, output what would happen without changing files.

    Raises:
        RuntimeError: when bumpver fails to execute successfully.
    """
    # bumpver's --set-version explicitly bypasses standard major/minor incrementing
    cmd = f"bumpver update --set-version={new_version}"
    if dry_run:
        cmd += " --dry"
    run_shell_command(cmd)


if __name__ == "__main__":
    logging.basicConfig(level=logging.INFO)

    # Example execution
    bump(new_version="2.0.0", dry_run=True)
