Loading README.md +5 −6 Changes for README.md: 5 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -31,13 +31,13 @@ The following step is required before using the tool: gitlab-projects-settings # Protect all projects' tags under a group gitlab-projects-settings --protect-tags -- 'https://gitlab.com' 'group' gitlab-projects-settings --protect-tags -- 'https://gitlab.com/group' # Update all avatars and descriptions under a group gitlab-projects-settings --set-avatar ./avatar.png --update-description 'https://gitlab.com' 'group' gitlab-projects-settings --set-avatar ./avatar.png --update-description 'https://gitlab.com/group' # Automatically detect and reset features of projects based on usage gitlab-projects-settings --reset-features 'https://gitlab.com' 'group/project' gitlab-projects-settings --reset-features 'https://gitlab.com/group/project' ``` <!-- prettier-ignore-end --> Loading @@ -57,7 +57,7 @@ usage: gitlab-projects-settings [-h] [--version] [--update-check] [--settings] [ [--set-avatar FILE] [--set-description TEXT] [--update-description] [--run-housekeeping] [--archive-project | --unarchive-project] [--delete-group] [--delete-project] [--protect-branches] [--protect-tags [LEVEL]] [--] [gitlab] [path] [url_path] gitlab-projects-settings: Configure GitLab groups and projects settings automatically Loading Loading @@ -103,8 +103,7 @@ repository settings arguments: positional arguments: -- # Positional arguments separator (recommended) gitlab # GitLab URL (default: https://gitlab.com) path # GitLab group, user namespace or project path url_path # GitLab group or project path URL ``` <!-- readme-help-stop --> Loading src/cli/entrypoint.py +13 −7 Changes for src/cli/entrypoint.py: 13 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ from argparse import Namespace from enum import Enum from typing import Optional import urllib.parse # Modules libraries from gitlab.exceptions import GitlabGetError Loading @@ -27,7 +28,7 @@ class Entrypoint: # Enumerations Result = Enum('Result', ['SUCCESS', 'FINALIZE', 'ERROR', 'CRITICAL']) # CLI, pylint: disable=too-many-branches # CLI, pylint: disable=too-many-branches,too-many-statements @staticmethod def cli(options: Namespace) -> Result: Loading @@ -40,9 +41,14 @@ class Entrypoint: # Header print(' ') # Parse URL variables gitlab_splits: urllib.parse.SplitResult = urllib.parse.urlsplit(options.url_path) gitlab_url: str = f'{gitlab_splits.scheme}://{gitlab_splits.netloc}' gitlab_path: str = gitlab_splits.path.lstrip('/') # GitLab client gitlab = GitLabFeature( options.gitlab, gitlab_url, options.token, options.dry_run, ) Loading @@ -53,7 +59,7 @@ class Entrypoint: # GitLab path try: group = gitlab.group(options.path) group = gitlab.group(gitlab_path) print(f'{Colors.BOLD} - GitLab group: ' f'{Colors.GREEN}{group.full_path}' f'{Colors.CYAN} ({group.description})' Loading @@ -62,10 +68,10 @@ class Entrypoint: Platform.flush() except GitlabGetError as exception: try: if '/' in options.path: if '/' in gitlab_path: raise TypeError from exception user = gitlab.user(options.path) namespace = gitlab.namespace(options.path) user = gitlab.user(gitlab_path) namespace = gitlab.namespace(gitlab_path) print(f'{Colors.BOLD} - GitLab user namespace: ' f'{Colors.GREEN}{namespace.full_path}' f'{Colors.CYAN} ({namespace.name})' Loading @@ -73,7 +79,7 @@ class Entrypoint: print(' ') Platform.flush() except (GitlabGetError, TypeError): project = gitlab.project(options.path) project = gitlab.project(gitlab_path) print(f'{Colors.BOLD} - GitLab project: ' f'{Colors.GREEN}{project.path_with_namespace}' f'{Colors.CYAN} ({project.description})' Loading src/cli/main.py +3 −10 Changes for src/cli/main.py: 3 added lines, 10 removed lines. Original line number Diff line number Diff line Loading @@ -238,17 +238,10 @@ def main() -> None: help='Positional arguments separator (recommended)', ) group.add_argument( dest='gitlab', dest='url_path', action='store', nargs='?', default='https://gitlab.com', help='GitLab URL (default: %(default)s)', ) group.add_argument( dest='path', action='store', nargs='?', help='GitLab group, user namespace or project path', help='GitLab group or project path URL', ) # Arguments parser Loading Loading @@ -297,7 +290,7 @@ def main() -> None: sys_exit(0) # Arguments validation if not options.token or not options.gitlab or not options.path: if not options.token or not options.url_path: result = Entrypoint.Result.CRITICAL # Header Loading Loading
README.md +5 −6 Changes for README.md: 5 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -31,13 +31,13 @@ The following step is required before using the tool: gitlab-projects-settings # Protect all projects' tags under a group gitlab-projects-settings --protect-tags -- 'https://gitlab.com' 'group' gitlab-projects-settings --protect-tags -- 'https://gitlab.com/group' # Update all avatars and descriptions under a group gitlab-projects-settings --set-avatar ./avatar.png --update-description 'https://gitlab.com' 'group' gitlab-projects-settings --set-avatar ./avatar.png --update-description 'https://gitlab.com/group' # Automatically detect and reset features of projects based on usage gitlab-projects-settings --reset-features 'https://gitlab.com' 'group/project' gitlab-projects-settings --reset-features 'https://gitlab.com/group/project' ``` <!-- prettier-ignore-end --> Loading @@ -57,7 +57,7 @@ usage: gitlab-projects-settings [-h] [--version] [--update-check] [--settings] [ [--set-avatar FILE] [--set-description TEXT] [--update-description] [--run-housekeeping] [--archive-project | --unarchive-project] [--delete-group] [--delete-project] [--protect-branches] [--protect-tags [LEVEL]] [--] [gitlab] [path] [url_path] gitlab-projects-settings: Configure GitLab groups and projects settings automatically Loading Loading @@ -103,8 +103,7 @@ repository settings arguments: positional arguments: -- # Positional arguments separator (recommended) gitlab # GitLab URL (default: https://gitlab.com) path # GitLab group, user namespace or project path url_path # GitLab group or project path URL ``` <!-- readme-help-stop --> Loading
src/cli/entrypoint.py +13 −7 Changes for src/cli/entrypoint.py: 13 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ from argparse import Namespace from enum import Enum from typing import Optional import urllib.parse # Modules libraries from gitlab.exceptions import GitlabGetError Loading @@ -27,7 +28,7 @@ class Entrypoint: # Enumerations Result = Enum('Result', ['SUCCESS', 'FINALIZE', 'ERROR', 'CRITICAL']) # CLI, pylint: disable=too-many-branches # CLI, pylint: disable=too-many-branches,too-many-statements @staticmethod def cli(options: Namespace) -> Result: Loading @@ -40,9 +41,14 @@ class Entrypoint: # Header print(' ') # Parse URL variables gitlab_splits: urllib.parse.SplitResult = urllib.parse.urlsplit(options.url_path) gitlab_url: str = f'{gitlab_splits.scheme}://{gitlab_splits.netloc}' gitlab_path: str = gitlab_splits.path.lstrip('/') # GitLab client gitlab = GitLabFeature( options.gitlab, gitlab_url, options.token, options.dry_run, ) Loading @@ -53,7 +59,7 @@ class Entrypoint: # GitLab path try: group = gitlab.group(options.path) group = gitlab.group(gitlab_path) print(f'{Colors.BOLD} - GitLab group: ' f'{Colors.GREEN}{group.full_path}' f'{Colors.CYAN} ({group.description})' Loading @@ -62,10 +68,10 @@ class Entrypoint: Platform.flush() except GitlabGetError as exception: try: if '/' in options.path: if '/' in gitlab_path: raise TypeError from exception user = gitlab.user(options.path) namespace = gitlab.namespace(options.path) user = gitlab.user(gitlab_path) namespace = gitlab.namespace(gitlab_path) print(f'{Colors.BOLD} - GitLab user namespace: ' f'{Colors.GREEN}{namespace.full_path}' f'{Colors.CYAN} ({namespace.name})' Loading @@ -73,7 +79,7 @@ class Entrypoint: print(' ') Platform.flush() except (GitlabGetError, TypeError): project = gitlab.project(options.path) project = gitlab.project(gitlab_path) print(f'{Colors.BOLD} - GitLab project: ' f'{Colors.GREEN}{project.path_with_namespace}' f'{Colors.CYAN} ({project.description})' Loading
src/cli/main.py +3 −10 Changes for src/cli/main.py: 3 added lines, 10 removed lines. Original line number Diff line number Diff line Loading @@ -238,17 +238,10 @@ def main() -> None: help='Positional arguments separator (recommended)', ) group.add_argument( dest='gitlab', dest='url_path', action='store', nargs='?', default='https://gitlab.com', help='GitLab URL (default: %(default)s)', ) group.add_argument( dest='path', action='store', nargs='?', help='GitLab group, user namespace or project path', help='GitLab group or project path URL', ) # Arguments parser Loading Loading @@ -297,7 +290,7 @@ def main() -> None: sys_exit(0) # Arguments validation if not options.token or not options.gitlab or not options.path: if not options.token or not options.url_path: result = Entrypoint.Result.CRITICAL # Header Loading