1
0

pkgs/git-show-link: Match names with special chars too

This commit is contained in:
clerie 2025-03-06 20:14:27 +01:00
parent dbd16ed438
commit 7254525c8e

@ -7,13 +7,13 @@ import subprocess
REMOTE_TYPES = [
{
# github
"match": re.compile(r'git@github.com:(?P<username>\w+)/(?P<project>\w+).git'),
"match": re.compile(r'git@github.com:(?P<username>[\w\.-]+)/(?P<project>[\w\.-]+).git'),
"format-branch": lambda g, b: f"https://github.com/{g['username']}/{g['project']}/tree/{b}/",
"format-commit": lambda g, c: f"https://github.com/{g['username']}/{g['project']}/commit/{c}/",
},
{
# gitea
"match": re.compile(r'(?P<gituser>\w+)@(?P<host>[\w\.-]+):(?P<username>\w+)/(?P<project>\w+).git'),
"match": re.compile(r'(?P<gituser>[\w\.-]+)@(?P<host>[\w\.-]+):(?P<username>[\w\.-]+)/(?P<project>[\w\.-]+).git'),
"format-branch": lambda g, b: f"https://{g['host']}/{g['username']}/{g['project']}/src/branch/{b}/",
"format-commit": lambda g, c: f"https://{g['host']}/{g['username']}/{g['project']}/commit/{c}/",
},