Skip to content

Commit

Permalink
fix: most recent tag not shown correctly in main menu
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
dw-0 committed Nov 24, 2024
1 parent 935f81a commit 4ae5a37
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion kiauh/utils/common.py
Original file line number Diff line number Diff line change
@@ -43,7 +43,8 @@ def get_kiauh_version() -> str:
Helper method to get the current KIAUH version by reading the latest tag
:return: string of the latest tag
"""
return get_local_tags(Path(__file__).parent.parent)[-1]
lastest_tag: str = get_local_tags(Path(__file__).parent.parent)[-1]
return lastest_tag


def convert_camelcase_to_kebabcase(name: str) -> str:
9 changes: 6 additions & 3 deletions kiauh/utils/git_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import json
import re
import shutil
import urllib.request
from http.client import HTTPResponse
@@ -118,7 +119,7 @@ def get_local_tags(repo_path: Path, _filter: str | None = None) -> List[str]:
:return: List of tags
"""
try:
cmd = ["git", "tag", "-l"]
cmd: List[str] = ["git", "tag", "-l"]

if _filter is not None:
cmd.append(f"'${_filter}'")
@@ -129,8 +130,10 @@ def get_local_tags(repo_path: Path, _filter: str | None = None) -> List[str]:
cwd=repo_path.as_posix(),
).decode(encoding="utf-8")

tags = result.split("\n")
return tags[:-1]
tags: List[str] = result.split("\n")[:-1]

return sorted(tags, key=lambda x: [int(i) if i.isdigit() else i for i in
re.split(r'(\d+)', x)])

except CalledProcessError:
return []

0 comments on commit 4ae5a37

Please sign in to comment.