Skip to content

Commit 3a48c67

Browse files
committed
fix: Don't replace : with / for https:// urls
1 parent 95798b8 commit 3a48c67

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ packages = ["src"]
3737
[tool.ruff.lint]
3838
select = ["ALL"]
3939
ignore = ["D", "G004", "INP001", "ERA001", "COM812", "ISC001"]
40-
mccabe.max-complexity = 6
40+
mccabe.max-complexity = 8
4141

4242
[tool.ruff]
4343
line-length = 88

src/gitro.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,15 @@ def main() -> int:
3939
if not origin:
4040
return 1
4141

42-
remote = origin.replace(":", "/").replace("git@", "https://")
42+
if origin.startswith("git@"):
43+
origin = origin.replace(":", "/").replace("git@", "https://")
44+
4345
if platform.system() == "Darwin":
44-
return subprocess.run(["open", remote], check=False).returncode # noqa: S603, S607
46+
return subprocess.run(["open", origin], check=False).returncode # noqa: S603, S607
4547
if platform.system() == "Linux":
46-
return subprocess.run(["xdg-open", remote], check=False).returncode # noqa: S603, S607
48+
return subprocess.run(["xdg-open", origin], check=False).returncode # noqa: S603, S607
4749
if platform.system() == "Windows":
48-
return subprocess.run(["start", remote], shell=True, check=True).returncode # noqa: S602, S607
50+
return subprocess.run(["start", origin], shell=True, check=True).returncode # noqa: S602, S607
4951
return 0
5052

5153

0 commit comments

Comments
 (0)