from pathlib import Path

from clarabot_nano.utility.java import get_java_command_output
from clarabot_nano.utility.path.java import java_compatible_absolute_path


def get_picoture_version(picoture_jar: Path) -> str:
    picoture_version_output = get_java_command_output("-jar", java_compatible_absolute_path(picoture_jar), "--version")
    tmp, _, picoture_version = picoture_version_output.strip().partition(" ")
    assert tmp == "Picoture" and picoture_version
    return f"\t{picoture_version}"
