replace kwargs for more clearly

This commit is contained in:
2022-03-09 23:52:19 +03:00
parent 2410429e03
commit f392b4c879
4 changed files with 27 additions and 14 deletions

View File

@@ -37,10 +37,10 @@ def create_parser() -> ArgumentParser:
parser.add_argument('-g', '--group', required=False, type=int,
help='Add group id it can be found under group name. Id must be integer')
parser.add_argument('-u', '--urls', nargs='+', help='Provide url or urls to mirror with it in format: '
'https://github.com/s3rius/FastAPI-template.git. '
'You can provide multiple urls separated by space. '
'Names will generate automatically from links')
parser.add_argument('-u', '--urls', nargs='+',
help='Provide url or urls to mirror with it in format: '
'https://github.com/s3rius/FastAPI-template.git. You can provide multiple urls '
'separated by space. Names will generate automatically from links')
parser.add_argument('-f', '--file', help='Add file with urls. Each url on new line. Can be combined with '
'--url option. Names will generate automatically from links')

View File

@@ -92,13 +92,14 @@ class RepositoryCreator:
elif request.status_code != self.HTTP_200_OK:
logger.error(f'Error pull repository. Status code: {request.status_code}. Reason: {request.text}')
def create_repository_mirror(self, **kwargs):
def create_repository_mirror(self, github_url: str, group_id: int):
"""
Base action for one thread. Creates repository, add mirror url and triggers pull at te end
:param kwargs: Can contain github url to mirror of, gitlab group ID
:param github_url: Github url which will be mirrored
:param group_id: Gitlab group id which contains created repository
"""
repo_id = self.__create_new_project(kwargs['url'], kwargs['group_id'])
url = self.__add_pull_mirror(kwargs['url'], repo_id)
repo_id = self.__create_new_project(github_url, group_id)
url = self.__add_pull_mirror(github_url, repo_id)
if url:
self.__pull_github_repo(url, repo_id)