Skip to content

Commit 512e20c

Browse files
committed
Split clone_repo for Git and Github CLI
1 parent fbd9c44 commit 512e20c

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

exercise_utils/git.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"""Wrapper for Git CLI commands."""
22

3-
from typing import List
3+
from typing import List, Optional
44

5-
from exercise_utils.cli import run_command
5+
from exercise_utils.cli import run, run_command
66

77

88
def tag(tag_name: str, verbose: bool) -> None:
@@ -83,3 +83,13 @@ def remove_remote(remote: str, verbose: bool) -> None:
8383
def add_remote(remote: str, remote_url: str, verbose: bool) -> None:
8484
"""Adds a remote with the given name and URL."""
8585
run_command(["git", "remote", "add", remote, remote_url], verbose)
86+
87+
88+
def clone_repo_with_git(
89+
repository_url: str, verbose: bool, name: Optional[str] = None
90+
) -> None:
91+
"""Clones a Git repository. Does not require Github CLI."""
92+
if name is not None:
93+
run(["git", "clone", repository_url, name], verbose)
94+
else:
95+
run(["git", "clone", repository_url], verbose)

exercise_utils/github_cli.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ def fork_repo(repository_name: str, fork_name: str, verbose: bool) -> None:
2222
)
2323

2424

25-
def clone_repo(repository_name: str, verbose: bool, name: Optional[str] = None) -> None:
26-
"""Creates a clone of a repository."""
25+
def clone_repo_with_gh(
26+
repository_name: str, verbose: bool, name: Optional[str] = None
27+
) -> None:
28+
"""Creates a clone of a repository using Github CLI."""
2729
if name is not None:
2830
run(["gh", "repo", "clone", repository_name, name], verbose)
2931
else:

0 commit comments

Comments
 (0)