refactor: trim ".git" from repo name

Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
dw-0
2024-08-17 19:35:38 +02:00
parent 660481af5a
commit 27b7651e11

View File

@@ -76,8 +76,9 @@ def get_repo_name(repo: Path) -> str | None:
try:
cmd = ["git", "-C", repo.as_posix(), "config", "--get", "remote.origin.url"]
result = check_output(cmd, stderr=DEVNULL)
return "/".join(result.decode().strip().split("/")[-2:])
result: str = check_output(cmd, stderr=DEVNULL).decode(encoding="utf-8")
substrings: List[str] = result.strip().split("/")[-2:]
return "/".join(substrings).replace(".git", "")
except CalledProcessError:
return None