Fix all commands and cleanup

This commit is contained in:
BillSchumacher
2023-04-19 18:17:04 -05:00
parent 23c650ca10
commit d7679d755f
16 changed files with 63 additions and 83 deletions

View File

@@ -11,24 +11,24 @@ CFG = Config()
@command(
"clone_repository",
"Clone Repositoryy",
'"repository_url": "<url>", "clone_path": "<directory>"',
'"repository_url": "<repository_url>", "clone_path": "<clone_path>"',
CFG.github_username and CFG.github_api_key,
"Configure github_username and github_api_key.",
)
def clone_repository(repo_url: str, clone_path: str) -> str:
def clone_repository(repository_url: str, clone_path: str) -> str:
"""Clone a GitHub repository locally
Args:
repo_url (str): The URL of the repository to clone
repository_url (str): The URL of the repository to clone
clone_path (str): The path to clone the repository to
Returns:
str: The result of the clone operation"""
split_url = repo_url.split("//")
split_url = repository_url.split("//")
auth_repo_url = f"//{CFG.github_username}:{CFG.github_api_key}@".join(split_url)
safe_clone_path = path_in_workspace(clone_path)
try:
Repo.clone_from(auth_repo_url, safe_clone_path)
return f"""Cloned {repo_url} to {safe_clone_path}"""
return f"""Cloned {repository_url} to {safe_clone_path}"""
except Exception as e:
return f"Error: {str(e)}"