mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-04-28 20:58:07 +03:00
22 lines
490 B
Python
22 lines
490 B
Python
from subprocess import check_output
|
|
|
|
|
|
def get_branch_version(branch: str | None) -> str:
|
|
return check_output(
|
|
[
|
|
"git",
|
|
"describe",
|
|
*([branch] if branch else ["--dirty"]),
|
|
"--always",
|
|
"--abbrev=7",
|
|
"--tags",
|
|
"--exclude",
|
|
"latest",
|
|
],
|
|
text=True,
|
|
).strip()
|
|
|
|
|
|
def generate_version() -> str:
|
|
version = get_branch_version(None)
|
|
return f'TR1X {version or "?"}'
|