refactor(RepoManager): default to master branch if none is provided
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
@@ -19,9 +19,14 @@ from kiauh.utils.logger import Logger
|
|||||||
|
|
||||||
# noinspection PyMethodMayBeStatic
|
# noinspection PyMethodMayBeStatic
|
||||||
class RepoManager:
|
class RepoManager:
|
||||||
def __init__(self, repo: str, branch: str, target_dir: str):
|
def __init__(
|
||||||
|
self,
|
||||||
|
repo: str,
|
||||||
|
target_dir: str,
|
||||||
|
branch: str = None,
|
||||||
|
):
|
||||||
self._repo = repo
|
self._repo = repo
|
||||||
self._branch = branch
|
self._branch = branch if branch is not None else "master"
|
||||||
self._method = self._get_method()
|
self._method = self._get_method()
|
||||||
self._target_dir = target_dir
|
self._target_dir = target_dir
|
||||||
|
|
||||||
@@ -62,9 +67,8 @@ class RepoManager:
|
|||||||
Logger.print_status(log)
|
Logger.print_status(log)
|
||||||
try:
|
try:
|
||||||
if os.path.exists(self.target_dir):
|
if os.path.exists(self.target_dir):
|
||||||
if not get_confirm(
|
question = f"'{self.target_dir}' already exists. Overwrite?"
|
||||||
"Target directory already exists. Overwrite?", default_choice=False
|
if not get_confirm(question, default_choice=False):
|
||||||
):
|
|
||||||
Logger.print_info("Skipping re-clone of repository.")
|
Logger.print_info("Skipping re-clone of repository.")
|
||||||
return
|
return
|
||||||
shutil.rmtree(self.target_dir)
|
shutil.rmtree(self.target_dir)
|
||||||
|
|||||||
Reference in New Issue
Block a user