Skip to content

Commit

Permalink
refactor(CS): make generate_folders_with_repo compliant with CS
Browse files Browse the repository at this point in the history
  • Loading branch information
Miou-zora committed Jul 8, 2023
1 parent a046419 commit e13ed7b
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/generate_folders_with_repo.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
#!/usr/bin/env python3
##
## @Miou-zora Project, Mirror-Generator, 2023
## generate_folders_with_repo.py
## File description:
## Generate folders with repo and mirror repo in.
##
# @Miou-zora Project, Mirror-Generator, 2023

import subprocess

def generate_folders_with_repo(ssh_key: str, project_name: str, user_name: str, repo_name: str, mirror_name: str):

def generate_folders_with_repo(ssh_key: str,
project_name: str,
user_name: str,
repo_name: str,
mirror_name: str):
mirror_ssh_link = f"git@github.com:{user_name}/{mirror_name}.git"
actions = [(["mkdir", project_name], "Folder already exist: " + project_name),
(["git", "clone", ssh_key], "Can't clone repository: " + ssh_key),
(["mv", repo_name, project_name], "Can't move folder: " + repo_name),
(["git", "clone", mirror_ssh_link], "Can't clone repository: " + mirror_ssh_link),
(["mv", mirror_name, project_name], "Can't move folder: " + mirror_name)]
actions = [(["mkdir", project_name],
"Folder already exist: " + project_name),
(["git", "clone", ssh_key],
"Can't clone repository: " + ssh_key),
(["mv", repo_name, project_name],
"Can't move folder: " + repo_name),
(["git", "clone", mirror_ssh_link],
"Can't clone repository: " + mirror_ssh_link),
(["mv", mirror_name, project_name],
"Can't move folder: " + mirror_name)]
for action in actions:
if subprocess.run(action[0]).returncode == 1:
raise Exception(action[1])

0 comments on commit e13ed7b

Please sign in to comment.