Loading gitlab_projects_settings/features/settings.py +62 −50 Changes for gitlab_projects_settings/features/settings.py: 62 added lines, 50 removed lines. Original line number Diff line number Diff line Loading @@ -83,12 +83,71 @@ class SettingsFeature: # Result return True # GitLab projects settings project, pylint: disable=too-many-branches # Group @staticmethod def project(options: Namespace, gitlab: GitLabFeature, criteria: str) -> None: def group( options: Namespace, gitlab: GitLabFeature, criteria: str, subgroup: bool = False, ) -> None: # Acquire group group = gitlab.group(criteria) # Show project details # Show group details group_type = 'subgroup' if subgroup else 'group' print(f'{Colors.BOLD} - GitLab {group_type}: ' f'{Colors.YELLOW_LIGHT}{group.full_path} ' f'{Colors.CYAN}({group.description})' f'{Colors.RESET}') # Set group description if options.set_description: gitlab.group_set_description(criteria, options.set_description) print(f'{Colors.BOLD} - Set description: ' f'{Colors.CYAN}{options.set_description}' f'{Colors.RESET}') # Update group description elif options.update_description: description = f'{group.name[:1].capitalize()}{group.name[1:]}' \ f' - description' gitlab.group_set_description(criteria, description) print(f'{Colors.BOLD} - Updated description: ' f'{Colors.CYAN}{description}' f'{Colors.RESET}') # Reset group members if options.reset_members: gitlab.group_reset_members(criteria) print(f'{Colors.BOLD} - Reset members: ' f'{Colors.GREEN}Success' f'{Colors.RESET}') # Set group avatar if options.set_avatar: gitlab.group_set_avatar(criteria, options.set_avatar) print(f'{Colors.BOLD} - Set avatar: ' f'{Colors.CYAN}{options.set_avatar}' f'{Colors.RESET}') # Footer print(' ') Platform.flush() # Project, pylint: disable=too-many-branches @staticmethod def project( options: Namespace, gitlab: GitLabFeature, criteria: str, ) -> None: # Acquire project project = gitlab.project(criteria) # Show project details print(f'{Colors.BOLD} - GitLab project: ' f'{Colors.YELLOW_LIGHT}{project.path_with_namespace} ' f'{Colors.CYAN}({project.description})' Loading Loading @@ -164,50 +223,3 @@ class SettingsFeature: # Footer print(' ') Platform.flush() # GitLab projects settings group @staticmethod def group(options: Namespace, gitlab: GitLabFeature, criteria: str, subgroup: bool = False) -> None: # Show group details group = gitlab.group(criteria) group_type = 'subgroup' if subgroup else 'group' print(f'{Colors.BOLD} - GitLab {group_type}: ' f'{Colors.YELLOW_LIGHT}{group.full_path} ' f'{Colors.CYAN}({group.description})' f'{Colors.RESET}') # Set group description if options.set_description: gitlab.group_set_description(criteria, options.set_description) print(f'{Colors.BOLD} - Set description: ' f'{Colors.CYAN}{options.set_description}' f'{Colors.RESET}') # Update group description elif options.update_description: description = f'{group.name[:1].capitalize()}{group.name[1:]}' \ f' - description' gitlab.group_set_description(criteria, description) print(f'{Colors.BOLD} - Updated description: ' f'{Colors.CYAN}{description}' f'{Colors.RESET}') # Reset group members if options.reset_members: gitlab.group_reset_members(criteria) print(f'{Colors.BOLD} - Reset members: ' f'{Colors.GREEN}Success' f'{Colors.RESET}') # Set group avatar if options.set_avatar: gitlab.group_set_avatar(criteria, options.set_avatar) print(f'{Colors.BOLD} - Set avatar: ' f'{Colors.CYAN}{options.set_avatar}' f'{Colors.RESET}') # Footer print(' ') Platform.flush() Loading
gitlab_projects_settings/features/settings.py +62 −50 Changes for gitlab_projects_settings/features/settings.py: 62 added lines, 50 removed lines. Original line number Diff line number Diff line Loading @@ -83,12 +83,71 @@ class SettingsFeature: # Result return True # GitLab projects settings project, pylint: disable=too-many-branches # Group @staticmethod def project(options: Namespace, gitlab: GitLabFeature, criteria: str) -> None: def group( options: Namespace, gitlab: GitLabFeature, criteria: str, subgroup: bool = False, ) -> None: # Acquire group group = gitlab.group(criteria) # Show project details # Show group details group_type = 'subgroup' if subgroup else 'group' print(f'{Colors.BOLD} - GitLab {group_type}: ' f'{Colors.YELLOW_LIGHT}{group.full_path} ' f'{Colors.CYAN}({group.description})' f'{Colors.RESET}') # Set group description if options.set_description: gitlab.group_set_description(criteria, options.set_description) print(f'{Colors.BOLD} - Set description: ' f'{Colors.CYAN}{options.set_description}' f'{Colors.RESET}') # Update group description elif options.update_description: description = f'{group.name[:1].capitalize()}{group.name[1:]}' \ f' - description' gitlab.group_set_description(criteria, description) print(f'{Colors.BOLD} - Updated description: ' f'{Colors.CYAN}{description}' f'{Colors.RESET}') # Reset group members if options.reset_members: gitlab.group_reset_members(criteria) print(f'{Colors.BOLD} - Reset members: ' f'{Colors.GREEN}Success' f'{Colors.RESET}') # Set group avatar if options.set_avatar: gitlab.group_set_avatar(criteria, options.set_avatar) print(f'{Colors.BOLD} - Set avatar: ' f'{Colors.CYAN}{options.set_avatar}' f'{Colors.RESET}') # Footer print(' ') Platform.flush() # Project, pylint: disable=too-many-branches @staticmethod def project( options: Namespace, gitlab: GitLabFeature, criteria: str, ) -> None: # Acquire project project = gitlab.project(criteria) # Show project details print(f'{Colors.BOLD} - GitLab project: ' f'{Colors.YELLOW_LIGHT}{project.path_with_namespace} ' f'{Colors.CYAN}({project.description})' Loading Loading @@ -164,50 +223,3 @@ class SettingsFeature: # Footer print(' ') Platform.flush() # GitLab projects settings group @staticmethod def group(options: Namespace, gitlab: GitLabFeature, criteria: str, subgroup: bool = False) -> None: # Show group details group = gitlab.group(criteria) group_type = 'subgroup' if subgroup else 'group' print(f'{Colors.BOLD} - GitLab {group_type}: ' f'{Colors.YELLOW_LIGHT}{group.full_path} ' f'{Colors.CYAN}({group.description})' f'{Colors.RESET}') # Set group description if options.set_description: gitlab.group_set_description(criteria, options.set_description) print(f'{Colors.BOLD} - Set description: ' f'{Colors.CYAN}{options.set_description}' f'{Colors.RESET}') # Update group description elif options.update_description: description = f'{group.name[:1].capitalize()}{group.name[1:]}' \ f' - description' gitlab.group_set_description(criteria, description) print(f'{Colors.BOLD} - Updated description: ' f'{Colors.CYAN}{description}' f'{Colors.RESET}') # Reset group members if options.reset_members: gitlab.group_reset_members(criteria) print(f'{Colors.BOLD} - Reset members: ' f'{Colors.GREEN}Success' f'{Colors.RESET}') # Set group avatar if options.set_avatar: gitlab.group_set_avatar(criteria, options.set_avatar) print(f'{Colors.BOLD} - Set avatar: ' f'{Colors.CYAN}{options.set_avatar}' f'{Colors.RESET}') # Footer print(' ') Platform.flush()