gitlab-projects-settings 2.0.0__tar.gz → 2.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/.gitlab-ci.yml +1 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/CHANGELOG.md +24 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/PKG-INFO +5 -1
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/README.md +4 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/gitlab_projects_settings.egg-info/PKG-INFO +5 -1
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/src/cli/entrypoint.py +30 -5
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/src/cli/main.py +5 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/src/features/gitlab.py +18 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/.chglog/CHANGELOG.tpl.md +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/.chglog/changelog.sh +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/.chglog/config.yml +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/.gitignore +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/.markdownlint.json +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/.style.yapf +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/.vscode/extensions.json +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/.vscode/settings.json +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/LICENSE +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/gitlab_projects_settings.egg-info/SOURCES.txt +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/gitlab_projects_settings.egg-info/dependency_links.txt +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/gitlab_projects_settings.egg-info/entry_points.txt +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/gitlab_projects_settings.egg-info/requires.txt +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/gitlab_projects_settings.egg-info/top_level.txt +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/mypy.ini +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/requirements/build.txt +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/requirements/deploy.txt +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/requirements/quality.txt +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/requirements/runtime.txt +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/setup.cfg +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/setup.py +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/src/__init__.py +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/src/__main__.py +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/src/cli/__init__.py +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/src/features/__init__.py +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/src/package/__init__.py +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/src/package/bundle.py +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/src/package/version.py +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/src/prints/__init__.py +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/src/prints/colors.py +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/src/system/__init__.py +0 -0
- {gitlab_projects_settings-2.0.0 → gitlab_projects_settings-2.0.2}/src/system/platform.py +0 -0
|
@@ -1,4 +1,28 @@
|
|
|
1
1
|
|
|
2
|
+
<a name="2.0.2"></a>
|
|
3
|
+
## [2.0.2](https://gitlab.com/AdrianDC/gitlab-projects-settings/compare/2.0.1...2.0.2) (2024-04-28)
|
|
4
|
+
|
|
5
|
+
### Ci
|
|
6
|
+
|
|
7
|
+
* **gitlab-ci:** disable 'typing' mypy caching with 'MYPY_CACHE_DIR'
|
|
8
|
+
|
|
9
|
+
### Documentation
|
|
10
|
+
|
|
11
|
+
* **readme:** document GitLab tokens' creation instructions
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* **main:** limit '--help' width to terminal width or 120 chars
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
<a name="2.0.1"></a>
|
|
19
|
+
## [2.0.1](https://gitlab.com/AdrianDC/gitlab-projects-settings/compare/2.0.0...2.0.1) (2024-04-28)
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* **entrypoint:** fix description updates faulty descriptions
|
|
24
|
+
|
|
25
|
+
|
|
2
26
|
<a name="2.0.0"></a>
|
|
3
27
|
## [2.0.0](https://gitlab.com/AdrianDC/gitlab-projects-settings/compare/1.1.0...2.0.0) (2024-04-27)
|
|
4
28
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: gitlab-projects-settings
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: Configure GitLab groups and projects settings automatically
|
|
5
5
|
Home-page: https://gitlab.com/AdrianDC/gitlab-projects-settings
|
|
6
6
|
Author: Adrian DC
|
|
@@ -50,6 +50,10 @@ of groups, subgroups and projects, using multiple available options.
|
|
|
50
50
|
Repetitive tasks can be performed accross multiple projects at once,
|
|
51
51
|
for example protecting tags and branches, or setting a new avatar recursively.
|
|
52
52
|
|
|
53
|
+
The following step is required before using the tool:
|
|
54
|
+
|
|
55
|
+
- The GitLab user tokens must be created with an `api` scope (a short expiration date is recommended)
|
|
56
|
+
|
|
53
57
|
---
|
|
54
58
|
|
|
55
59
|
## Usage
|
|
@@ -16,6 +16,10 @@ of groups, subgroups and projects, using multiple available options.
|
|
|
16
16
|
Repetitive tasks can be performed accross multiple projects at once,
|
|
17
17
|
for example protecting tags and branches, or setting a new avatar recursively.
|
|
18
18
|
|
|
19
|
+
The following step is required before using the tool:
|
|
20
|
+
|
|
21
|
+
- The GitLab user tokens must be created with an `api` scope (a short expiration date is recommended)
|
|
22
|
+
|
|
19
23
|
---
|
|
20
24
|
|
|
21
25
|
## Usage
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: gitlab-projects-settings
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: Configure GitLab groups and projects settings automatically
|
|
5
5
|
Home-page: https://gitlab.com/AdrianDC/gitlab-projects-settings
|
|
6
6
|
Author: Adrian DC
|
|
@@ -50,6 +50,10 @@ of groups, subgroups and projects, using multiple available options.
|
|
|
50
50
|
Repetitive tasks can be performed accross multiple projects at once,
|
|
51
51
|
for example protecting tags and branches, or setting a new avatar recursively.
|
|
52
52
|
|
|
53
|
+
The following step is required before using the tool:
|
|
54
|
+
|
|
55
|
+
- The GitLab user tokens must be created with an `api` scope (a short expiration date is recommended)
|
|
56
|
+
|
|
53
57
|
---
|
|
54
58
|
|
|
55
59
|
## Usage
|
|
@@ -118,6 +118,18 @@ class Entrypoint:
|
|
|
118
118
|
# Acquire group
|
|
119
119
|
group = gitlab.group(criteria)
|
|
120
120
|
|
|
121
|
+
# Acquire parent group
|
|
122
|
+
parent_group: Group = None
|
|
123
|
+
if group.parent_id:
|
|
124
|
+
parent_group = gitlab.group(group.parent_id)
|
|
125
|
+
|
|
126
|
+
# Get parent description
|
|
127
|
+
parent_description: str = ''
|
|
128
|
+
parent_name: str = ''
|
|
129
|
+
if parent_group:
|
|
130
|
+
parent_description = parent_group.description
|
|
131
|
+
parent_name = parent_group.name
|
|
132
|
+
|
|
121
133
|
# Show group details
|
|
122
134
|
group_type = 'subgroup' if subgroup else 'group'
|
|
123
135
|
print(f'{Colors.BOLD} - GitLab {group_type}: '
|
|
@@ -134,8 +146,14 @@ class Entrypoint:
|
|
|
134
146
|
|
|
135
147
|
# Update group description
|
|
136
148
|
elif options.update_description:
|
|
137
|
-
|
|
138
|
-
|
|
149
|
+
parent_description_text: str = ''
|
|
150
|
+
if parent_name:
|
|
151
|
+
parent_description_text = ' - ' + GitLabFeature.Helper.describe(
|
|
152
|
+
parent_description,
|
|
153
|
+
parent_name,
|
|
154
|
+
)
|
|
155
|
+
description = f'{GitLabFeature.Helper.capitalize(group.name)}' \
|
|
156
|
+
f'{parent_description_text}'
|
|
139
157
|
gitlab.group_set_description(criteria, description)
|
|
140
158
|
print(f'{Colors.BOLD} - Updated description: '
|
|
141
159
|
f'{Colors.CYAN}{description}'
|
|
@@ -170,6 +188,9 @@ class Entrypoint:
|
|
|
170
188
|
# Acquire project
|
|
171
189
|
project = gitlab.project(criteria)
|
|
172
190
|
|
|
191
|
+
# Acquire group
|
|
192
|
+
group = gitlab.group(project.namespace['id'])
|
|
193
|
+
|
|
173
194
|
# Show project details
|
|
174
195
|
print(f'{Colors.BOLD} - GitLab project: '
|
|
175
196
|
f'{Colors.YELLOW_LIGHT}{project.path_with_namespace} '
|
|
@@ -185,11 +206,15 @@ class Entrypoint:
|
|
|
185
206
|
|
|
186
207
|
# Update project description
|
|
187
208
|
elif options.update_description:
|
|
188
|
-
|
|
189
|
-
|
|
209
|
+
group_description = GitLabFeature.Helper.describe(
|
|
210
|
+
group.description,
|
|
211
|
+
group.name,
|
|
212
|
+
)
|
|
213
|
+
description = f'{GitLabFeature.Helper.capitalize(project.name)}' \
|
|
214
|
+
f' - {group_description}'
|
|
190
215
|
gitlab.project_set_description(criteria, description)
|
|
191
216
|
print(f'{Colors.BOLD} - Updated description: '
|
|
192
|
-
f'{Colors.CYAN}{
|
|
217
|
+
f'{Colors.CYAN}{group_description}'
|
|
193
218
|
f'{Colors.RESET}')
|
|
194
219
|
|
|
195
220
|
# Reset project features
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
# Standard libraries
|
|
4
4
|
from argparse import (_ArgumentGroup, ArgumentParser, Namespace, RawTextHelpFormatter)
|
|
5
5
|
from os import environ
|
|
6
|
+
from shutil import get_terminal_size
|
|
6
7
|
from sys import exit as sys_exit
|
|
7
8
|
|
|
8
9
|
# Components
|
|
@@ -27,6 +28,10 @@ def main() -> None:
|
|
|
27
28
|
formatter_class=lambda prog: RawTextHelpFormatter(
|
|
28
29
|
prog,
|
|
29
30
|
max_help_position=30,
|
|
31
|
+
width=min(
|
|
32
|
+
120,
|
|
33
|
+
get_terminal_size().columns - 2,
|
|
34
|
+
),
|
|
30
35
|
),
|
|
31
36
|
)
|
|
32
37
|
|
|
@@ -317,3 +317,21 @@ class GitLabFeature:
|
|
|
317
317
|
@property
|
|
318
318
|
def url(self) -> str:
|
|
319
319
|
return str(self.__gitlab.api_url)
|
|
320
|
+
|
|
321
|
+
# Helper class
|
|
322
|
+
class Helper:
|
|
323
|
+
|
|
324
|
+
# Capitalize
|
|
325
|
+
@staticmethod
|
|
326
|
+
def capitalize(text: str) -> str:
|
|
327
|
+
return f'{text[:1].capitalize()}{text[1:]}'
|
|
328
|
+
|
|
329
|
+
# Describe
|
|
330
|
+
@staticmethod
|
|
331
|
+
def describe(
|
|
332
|
+
description: str,
|
|
333
|
+
name: str,
|
|
334
|
+
) -> str:
|
|
335
|
+
if description:
|
|
336
|
+
return description
|
|
337
|
+
return GitLabFeature.Helper.capitalize(name)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|