gitlab-projects-settings 4.0.0__tar.gz → 4.2.0__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-4.0.0 → gitlab_projects_settings-4.2.0}/CHANGELOG.md +23 -0
- {gitlab_projects_settings-4.0.0/gitlab_projects_settings.egg-info → gitlab_projects_settings-4.2.0}/PKG-INFO +38 -4
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/README.md +36 -3
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0/gitlab_projects_settings.egg-info}/PKG-INFO +38 -4
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/gitlab_projects_settings.egg-info/SOURCES.txt +1 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/gitlab_projects_settings.egg-info/requires.txt +1 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/requirements/runtime.txt +1 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/src/cli/entrypoint.py +57 -3
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/src/cli/main.py +19 -8
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/src/features/gitlab.py +5 -5
- gitlab_projects_settings-4.2.0/src/prints/themes.py +60 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/src/types/gitlab.py +22 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/.chglog/CHANGELOG.tpl.md +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/.chglog/changelog.sh +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/.chglog/config.yml +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/.gitignore +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/.gitlab-ci.yml +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/.markdownlint.json +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/.style.yapf +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/.vscode/extensions.json +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/.vscode/settings.json +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/LICENSE +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/gitlab_projects_settings.egg-info/dependency_links.txt +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/gitlab_projects_settings.egg-info/entry_points.txt +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/gitlab_projects_settings.egg-info/top_level.txt +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/mypy.ini +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/requirements/build.txt +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/requirements/deploy.txt +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/requirements/quality.txt +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/setup.cfg +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/setup.py +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/src/__init__.py +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/src/__main__.py +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/src/cli/__init__.py +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/src/features/__init__.py +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/src/package/__init__.py +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/src/package/bundle.py +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/src/package/settings.py +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/src/package/updates.py +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/src/package/version.py +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/src/prints/__init__.py +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/src/prints/boxes.py +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/src/prints/colors.py +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/src/system/__init__.py +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/src/system/platform.py +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/src/types/__init__.py +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/src/types/namespaces.py +0 -0
- {gitlab_projects_settings-4.0.0 → gitlab_projects_settings-4.2.0}/src/types/strings.py +0 -0
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
|
|
2
|
+
<a name="4.2.0"></a>
|
|
3
|
+
## [4.2.0](https://gitlab.com/AdrianDC/gitlab-projects-settings/compare/4.1.0...4.2.0) (2024-05-27)
|
|
4
|
+
|
|
5
|
+
### Documentation
|
|
6
|
+
|
|
7
|
+
* **readme:** add 'gitlab-projects-settings' examples documentation
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **entrypoint:** improve outputs logs upon delections
|
|
12
|
+
* **main:** show newer updates message upon incompatible arguments
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
<a name="4.1.0"></a>
|
|
16
|
+
## [4.1.0](https://gitlab.com/AdrianDC/gitlab-projects-settings/compare/4.0.0...4.1.0) (2024-05-17)
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* **entrypoint:** implement prompt confirmation upon deletions
|
|
21
|
+
* **gitlab:** isolate 'ProtectionLevels' enumeration
|
|
22
|
+
* **requirements:** prepare 'questionary' library integration
|
|
23
|
+
|
|
24
|
+
|
|
2
25
|
<a name="4.0.0"></a>
|
|
3
26
|
## [4.0.0](https://gitlab.com/AdrianDC/gitlab-projects-settings/compare/3.0.0...4.0.0) (2024-05-15)
|
|
4
27
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: gitlab-projects-settings
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.2.0
|
|
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
|
|
@@ -30,6 +30,7 @@ Description-Content-Type: text/markdown
|
|
|
30
30
|
License-File: LICENSE
|
|
31
31
|
Requires-Dist: colored>=1.4.2
|
|
32
32
|
Requires-Dist: python-gitlab>=4.4.0
|
|
33
|
+
Requires-Dist: questionary>=2.0.1
|
|
33
34
|
Requires-Dist: setuptools>=45.1.0
|
|
34
35
|
Requires-Dist: update_checker>=0.18.0
|
|
35
36
|
|
|
@@ -57,6 +58,28 @@ The following step is required before using the tool:
|
|
|
57
58
|
|
|
58
59
|
---
|
|
59
60
|
|
|
61
|
+
## Examples
|
|
62
|
+
|
|
63
|
+
<!-- prettier-ignore-start -->
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Show the helper menu
|
|
67
|
+
gitlab-projects-settings
|
|
68
|
+
|
|
69
|
+
# Protect all projects' tags under a group
|
|
70
|
+
gitlab-projects-settings --protect-tags -- 'https://gitlab.com' 'group'
|
|
71
|
+
|
|
72
|
+
# Update all avatars and descriptions under a group
|
|
73
|
+
gitlab-projects-settings --set-avatar ./avatar.png --update-description 'https://gitlab.com' 'group'
|
|
74
|
+
|
|
75
|
+
# Automatically detect and reset features of projects based on usage
|
|
76
|
+
gitlab-projects-settings --reset-features 'https://gitlab.com' 'group/project'
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
<!-- prettier-ignore-end -->
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
60
83
|
## Usage
|
|
61
84
|
|
|
62
85
|
<!-- prettier-ignore-start -->
|
|
@@ -64,12 +87,12 @@ The following step is required before using the tool:
|
|
|
64
87
|
|
|
65
88
|
```yaml
|
|
66
89
|
usage: gitlab-projects-settings [-h] [--version] [--update-check] [--settings] [--set GROUP KEY VAL] [-t TOKEN]
|
|
67
|
-
[--dry-run] [--exclude-group] [--exclude-subgroups] [--exclude-projects]
|
|
90
|
+
[--dry-run] [--dump] [--exclude-group] [--exclude-subgroups] [--exclude-projects]
|
|
68
91
|
[--available-features] [--reset-features [KEEP_FEATURES]]
|
|
69
92
|
[--disable-features FEATURES] [--enable-features FEATURES] [--reset-members]
|
|
70
93
|
[--set-avatar FILE] [--set-description TEXT] [--update-description]
|
|
71
94
|
[--run-housekeeping] [--archive-project | --unarchive-project] [--delete-group]
|
|
72
|
-
[--delete-project] [--protect-branches] [--protect-tags LEVEL] [--]
|
|
95
|
+
[--delete-project] [--protect-branches] [--protect-tags [LEVEL]] [--]
|
|
73
96
|
[gitlab] [path]
|
|
74
97
|
|
|
75
98
|
gitlab-projects-settings: Configure GitLab groups and projects settings automatically
|
|
@@ -87,6 +110,7 @@ credentials arguments:
|
|
|
87
110
|
|
|
88
111
|
common settings arguments:
|
|
89
112
|
--dry-run # Enable dry run mode to check without saving
|
|
113
|
+
--dump # Dump Python objects of groups and projects
|
|
90
114
|
--exclude-group # Exclude parent group settings
|
|
91
115
|
--exclude-subgroups # Exclude children subgroups settings
|
|
92
116
|
--exclude-projects # Exclude children projects settings
|
|
@@ -111,7 +135,7 @@ advanced settings arguments:
|
|
|
111
135
|
|
|
112
136
|
repository settings arguments:
|
|
113
137
|
--protect-branches # Protect branches with default master/main, develop and staging
|
|
114
|
-
--protect-tags LEVEL
|
|
138
|
+
--protect-tags [LEVEL] # Protect tags at level [no-one,admins,maintainers,developers] (default: no-one)
|
|
115
139
|
|
|
116
140
|
positional arguments:
|
|
117
141
|
-- # Positional arguments separator (recommended)
|
|
@@ -138,10 +162,20 @@ gitlab-projects-settings --settings
|
|
|
138
162
|
|
|
139
163
|
---
|
|
140
164
|
|
|
165
|
+
## Environment available configurations
|
|
166
|
+
|
|
167
|
+
`gitlab-projects-settings` uses `colored` for colors outputs and `questionary` for interactive menus.
|
|
168
|
+
|
|
169
|
+
If colors of both outputs types do not match the terminal's theme,
|
|
170
|
+
an environment variable `NO_COLOR=1` can be defined to disable colors.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
141
174
|
## Dependencies
|
|
142
175
|
|
|
143
176
|
- [colored](https://pypi.org/project/colored/): Terminal colors and styles
|
|
144
177
|
- [python-gitlab](https://pypi.org/project/python-gitlab/): A python wrapper for the GitLab API
|
|
178
|
+
- [questionary](https://pypi.org/project/questionary/): Interactive terminal user interfaces
|
|
145
179
|
- [setuptools](https://pypi.org/project/setuptools/): Build and manage Python packages
|
|
146
180
|
- [update-checker](https://pypi.org/project/update-checker/): Check for package updates on PyPI
|
|
147
181
|
|
|
@@ -22,6 +22,28 @@ The following step is required before using the tool:
|
|
|
22
22
|
|
|
23
23
|
---
|
|
24
24
|
|
|
25
|
+
## Examples
|
|
26
|
+
|
|
27
|
+
<!-- prettier-ignore-start -->
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Show the helper menu
|
|
31
|
+
gitlab-projects-settings
|
|
32
|
+
|
|
33
|
+
# Protect all projects' tags under a group
|
|
34
|
+
gitlab-projects-settings --protect-tags -- 'https://gitlab.com' 'group'
|
|
35
|
+
|
|
36
|
+
# Update all avatars and descriptions under a group
|
|
37
|
+
gitlab-projects-settings --set-avatar ./avatar.png --update-description 'https://gitlab.com' 'group'
|
|
38
|
+
|
|
39
|
+
# Automatically detect and reset features of projects based on usage
|
|
40
|
+
gitlab-projects-settings --reset-features 'https://gitlab.com' 'group/project'
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
<!-- prettier-ignore-end -->
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
25
47
|
## Usage
|
|
26
48
|
|
|
27
49
|
<!-- prettier-ignore-start -->
|
|
@@ -29,12 +51,12 @@ The following step is required before using the tool:
|
|
|
29
51
|
|
|
30
52
|
```yaml
|
|
31
53
|
usage: gitlab-projects-settings [-h] [--version] [--update-check] [--settings] [--set GROUP KEY VAL] [-t TOKEN]
|
|
32
|
-
[--dry-run] [--exclude-group] [--exclude-subgroups] [--exclude-projects]
|
|
54
|
+
[--dry-run] [--dump] [--exclude-group] [--exclude-subgroups] [--exclude-projects]
|
|
33
55
|
[--available-features] [--reset-features [KEEP_FEATURES]]
|
|
34
56
|
[--disable-features FEATURES] [--enable-features FEATURES] [--reset-members]
|
|
35
57
|
[--set-avatar FILE] [--set-description TEXT] [--update-description]
|
|
36
58
|
[--run-housekeeping] [--archive-project | --unarchive-project] [--delete-group]
|
|
37
|
-
[--delete-project] [--protect-branches] [--protect-tags LEVEL] [--]
|
|
59
|
+
[--delete-project] [--protect-branches] [--protect-tags [LEVEL]] [--]
|
|
38
60
|
[gitlab] [path]
|
|
39
61
|
|
|
40
62
|
gitlab-projects-settings: Configure GitLab groups and projects settings automatically
|
|
@@ -52,6 +74,7 @@ credentials arguments:
|
|
|
52
74
|
|
|
53
75
|
common settings arguments:
|
|
54
76
|
--dry-run # Enable dry run mode to check without saving
|
|
77
|
+
--dump # Dump Python objects of groups and projects
|
|
55
78
|
--exclude-group # Exclude parent group settings
|
|
56
79
|
--exclude-subgroups # Exclude children subgroups settings
|
|
57
80
|
--exclude-projects # Exclude children projects settings
|
|
@@ -76,7 +99,7 @@ advanced settings arguments:
|
|
|
76
99
|
|
|
77
100
|
repository settings arguments:
|
|
78
101
|
--protect-branches # Protect branches with default master/main, develop and staging
|
|
79
|
-
--protect-tags LEVEL
|
|
102
|
+
--protect-tags [LEVEL] # Protect tags at level [no-one,admins,maintainers,developers] (default: no-one)
|
|
80
103
|
|
|
81
104
|
positional arguments:
|
|
82
105
|
-- # Positional arguments separator (recommended)
|
|
@@ -103,10 +126,20 @@ gitlab-projects-settings --settings
|
|
|
103
126
|
|
|
104
127
|
---
|
|
105
128
|
|
|
129
|
+
## Environment available configurations
|
|
130
|
+
|
|
131
|
+
`gitlab-projects-settings` uses `colored` for colors outputs and `questionary` for interactive menus.
|
|
132
|
+
|
|
133
|
+
If colors of both outputs types do not match the terminal's theme,
|
|
134
|
+
an environment variable `NO_COLOR=1` can be defined to disable colors.
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
106
138
|
## Dependencies
|
|
107
139
|
|
|
108
140
|
- [colored](https://pypi.org/project/colored/): Terminal colors and styles
|
|
109
141
|
- [python-gitlab](https://pypi.org/project/python-gitlab/): A python wrapper for the GitLab API
|
|
142
|
+
- [questionary](https://pypi.org/project/questionary/): Interactive terminal user interfaces
|
|
110
143
|
- [setuptools](https://pypi.org/project/setuptools/): Build and manage Python packages
|
|
111
144
|
- [update-checker](https://pypi.org/project/update-checker/): Check for package updates on PyPI
|
|
112
145
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: gitlab-projects-settings
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.2.0
|
|
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
|
|
@@ -30,6 +30,7 @@ Description-Content-Type: text/markdown
|
|
|
30
30
|
License-File: LICENSE
|
|
31
31
|
Requires-Dist: colored>=1.4.2
|
|
32
32
|
Requires-Dist: python-gitlab>=4.4.0
|
|
33
|
+
Requires-Dist: questionary>=2.0.1
|
|
33
34
|
Requires-Dist: setuptools>=45.1.0
|
|
34
35
|
Requires-Dist: update_checker>=0.18.0
|
|
35
36
|
|
|
@@ -57,6 +58,28 @@ The following step is required before using the tool:
|
|
|
57
58
|
|
|
58
59
|
---
|
|
59
60
|
|
|
61
|
+
## Examples
|
|
62
|
+
|
|
63
|
+
<!-- prettier-ignore-start -->
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Show the helper menu
|
|
67
|
+
gitlab-projects-settings
|
|
68
|
+
|
|
69
|
+
# Protect all projects' tags under a group
|
|
70
|
+
gitlab-projects-settings --protect-tags -- 'https://gitlab.com' 'group'
|
|
71
|
+
|
|
72
|
+
# Update all avatars and descriptions under a group
|
|
73
|
+
gitlab-projects-settings --set-avatar ./avatar.png --update-description 'https://gitlab.com' 'group'
|
|
74
|
+
|
|
75
|
+
# Automatically detect and reset features of projects based on usage
|
|
76
|
+
gitlab-projects-settings --reset-features 'https://gitlab.com' 'group/project'
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
<!-- prettier-ignore-end -->
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
60
83
|
## Usage
|
|
61
84
|
|
|
62
85
|
<!-- prettier-ignore-start -->
|
|
@@ -64,12 +87,12 @@ The following step is required before using the tool:
|
|
|
64
87
|
|
|
65
88
|
```yaml
|
|
66
89
|
usage: gitlab-projects-settings [-h] [--version] [--update-check] [--settings] [--set GROUP KEY VAL] [-t TOKEN]
|
|
67
|
-
[--dry-run] [--exclude-group] [--exclude-subgroups] [--exclude-projects]
|
|
90
|
+
[--dry-run] [--dump] [--exclude-group] [--exclude-subgroups] [--exclude-projects]
|
|
68
91
|
[--available-features] [--reset-features [KEEP_FEATURES]]
|
|
69
92
|
[--disable-features FEATURES] [--enable-features FEATURES] [--reset-members]
|
|
70
93
|
[--set-avatar FILE] [--set-description TEXT] [--update-description]
|
|
71
94
|
[--run-housekeeping] [--archive-project | --unarchive-project] [--delete-group]
|
|
72
|
-
[--delete-project] [--protect-branches] [--protect-tags LEVEL] [--]
|
|
95
|
+
[--delete-project] [--protect-branches] [--protect-tags [LEVEL]] [--]
|
|
73
96
|
[gitlab] [path]
|
|
74
97
|
|
|
75
98
|
gitlab-projects-settings: Configure GitLab groups and projects settings automatically
|
|
@@ -87,6 +110,7 @@ credentials arguments:
|
|
|
87
110
|
|
|
88
111
|
common settings arguments:
|
|
89
112
|
--dry-run # Enable dry run mode to check without saving
|
|
113
|
+
--dump # Dump Python objects of groups and projects
|
|
90
114
|
--exclude-group # Exclude parent group settings
|
|
91
115
|
--exclude-subgroups # Exclude children subgroups settings
|
|
92
116
|
--exclude-projects # Exclude children projects settings
|
|
@@ -111,7 +135,7 @@ advanced settings arguments:
|
|
|
111
135
|
|
|
112
136
|
repository settings arguments:
|
|
113
137
|
--protect-branches # Protect branches with default master/main, develop and staging
|
|
114
|
-
--protect-tags LEVEL
|
|
138
|
+
--protect-tags [LEVEL] # Protect tags at level [no-one,admins,maintainers,developers] (default: no-one)
|
|
115
139
|
|
|
116
140
|
positional arguments:
|
|
117
141
|
-- # Positional arguments separator (recommended)
|
|
@@ -138,10 +162,20 @@ gitlab-projects-settings --settings
|
|
|
138
162
|
|
|
139
163
|
---
|
|
140
164
|
|
|
165
|
+
## Environment available configurations
|
|
166
|
+
|
|
167
|
+
`gitlab-projects-settings` uses `colored` for colors outputs and `questionary` for interactive menus.
|
|
168
|
+
|
|
169
|
+
If colors of both outputs types do not match the terminal's theme,
|
|
170
|
+
an environment variable `NO_COLOR=1` can be defined to disable colors.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
141
174
|
## Dependencies
|
|
142
175
|
|
|
143
176
|
- [colored](https://pypi.org/project/colored/): Terminal colors and styles
|
|
144
177
|
- [python-gitlab](https://pypi.org/project/python-gitlab/): A python wrapper for the GitLab API
|
|
178
|
+
- [questionary](https://pypi.org/project/questionary/): Interactive terminal user interfaces
|
|
145
179
|
- [setuptools](https://pypi.org/project/setuptools/): Build and manage Python packages
|
|
146
180
|
- [update-checker](https://pypi.org/project/update-checker/): Check for package updates on PyPI
|
|
147
181
|
|
|
@@ -12,10 +12,12 @@ from gitlab.v4.objects import (
|
|
|
12
12
|
Project as GitLabProject,
|
|
13
13
|
User as GitLabUser,
|
|
14
14
|
)
|
|
15
|
+
import questionary
|
|
15
16
|
|
|
16
17
|
# Components
|
|
17
18
|
from ..features.gitlab import GitLabFeature
|
|
18
19
|
from ..prints.colors import Colors
|
|
20
|
+
from ..prints.themes import Themes
|
|
19
21
|
from ..system.platform import Platform
|
|
20
22
|
from ..types.namespaces import Namespaces
|
|
21
23
|
|
|
@@ -23,7 +25,7 @@ from ..types.namespaces import Namespaces
|
|
|
23
25
|
class Entrypoint:
|
|
24
26
|
|
|
25
27
|
# Enumerations
|
|
26
|
-
Result = Enum('Result', ['SUCCESS', 'FINALIZE', 'ERROR'])
|
|
28
|
+
Result = Enum('Result', ['SUCCESS', 'FINALIZE', 'ERROR', 'CRITICAL'])
|
|
27
29
|
|
|
28
30
|
# CLI, pylint: disable=too-many-branches
|
|
29
31
|
@staticmethod
|
|
@@ -173,6 +175,30 @@ class Entrypoint:
|
|
|
173
175
|
# Result
|
|
174
176
|
return Entrypoint.Result.SUCCESS
|
|
175
177
|
|
|
178
|
+
# Confirm
|
|
179
|
+
@staticmethod
|
|
180
|
+
def confirm(description: str, text: str = '') -> bool:
|
|
181
|
+
|
|
182
|
+
# Header
|
|
183
|
+
print(
|
|
184
|
+
f'{Colors.BOLD} - Delete {description}: Confirm "'
|
|
185
|
+
f'{Colors.RED}{text}'
|
|
186
|
+
f'{Colors.BOLD}" deletion:'
|
|
187
|
+
f'{Colors.RESET}', end='')
|
|
188
|
+
Platform.flush()
|
|
189
|
+
|
|
190
|
+
# Get user configuration
|
|
191
|
+
answer: bool = questionary.confirm(
|
|
192
|
+
message='',
|
|
193
|
+
default=False,
|
|
194
|
+
qmark='',
|
|
195
|
+
style=Themes.confirmation_style(),
|
|
196
|
+
auto_enter=True,
|
|
197
|
+
).ask()
|
|
198
|
+
|
|
199
|
+
# Result
|
|
200
|
+
return answer
|
|
201
|
+
|
|
176
202
|
# Group
|
|
177
203
|
@staticmethod
|
|
178
204
|
def group(
|
|
@@ -205,8 +231,17 @@ class Entrypoint:
|
|
|
205
231
|
f'{Colors.RESET}')
|
|
206
232
|
Platform.flush()
|
|
207
233
|
|
|
208
|
-
# Delete group
|
|
234
|
+
# Delete group after validation
|
|
209
235
|
if options.delete_group:
|
|
236
|
+
if not Entrypoint.confirm(
|
|
237
|
+
group_type,
|
|
238
|
+
group.full_path,
|
|
239
|
+
):
|
|
240
|
+
print(' ')
|
|
241
|
+
Platform.flush()
|
|
242
|
+
return Entrypoint.Result.SUCCESS
|
|
243
|
+
|
|
244
|
+
# Delete group
|
|
210
245
|
gitlab.group_delete(criteria)
|
|
211
246
|
print(f'{Colors.BOLD} - Delete {group_type}: '
|
|
212
247
|
f'{Colors.GREEN}Success'
|
|
@@ -264,6 +299,11 @@ class Entrypoint:
|
|
|
264
299
|
f'{Colors.RESET}')
|
|
265
300
|
Platform.flush()
|
|
266
301
|
|
|
302
|
+
# Dump group object
|
|
303
|
+
if options.dump:
|
|
304
|
+
print(' ')
|
|
305
|
+
print(group.to_json())
|
|
306
|
+
|
|
267
307
|
# Footer
|
|
268
308
|
print(' ')
|
|
269
309
|
Platform.flush()
|
|
@@ -289,8 +329,17 @@ class Entrypoint:
|
|
|
289
329
|
f'{Colors.RESET}')
|
|
290
330
|
Platform.flush()
|
|
291
331
|
|
|
292
|
-
# Delete project
|
|
332
|
+
# Delete project after validation
|
|
293
333
|
if options.delete_project:
|
|
334
|
+
if not Entrypoint.confirm(
|
|
335
|
+
'project',
|
|
336
|
+
project.path_with_namespace,
|
|
337
|
+
):
|
|
338
|
+
print(' ')
|
|
339
|
+
Platform.flush()
|
|
340
|
+
return Entrypoint.Result.SUCCESS
|
|
341
|
+
|
|
342
|
+
# Delete project
|
|
294
343
|
gitlab.project_delete(criteria)
|
|
295
344
|
print(f'{Colors.BOLD} - Delete project: '
|
|
296
345
|
f'{Colors.GREEN}Success'
|
|
@@ -457,6 +506,11 @@ class Entrypoint:
|
|
|
457
506
|
f'{Colors.RESET}')
|
|
458
507
|
Platform.flush()
|
|
459
508
|
|
|
509
|
+
# Dump group object
|
|
510
|
+
if options.dump:
|
|
511
|
+
print(' ')
|
|
512
|
+
print(project.to_json())
|
|
513
|
+
|
|
460
514
|
# Footer
|
|
461
515
|
print(' ')
|
|
462
516
|
Platform.flush()
|
|
@@ -14,6 +14,7 @@ from ..package.updates import Updates
|
|
|
14
14
|
from ..package.version import Version
|
|
15
15
|
from ..prints.colors import Colors
|
|
16
16
|
from ..system.platform import Platform
|
|
17
|
+
from ..types.gitlab import ProtectionLevels
|
|
17
18
|
from .entrypoint import Entrypoint
|
|
18
19
|
|
|
19
20
|
# Main, pylint: disable=too-many-statements
|
|
@@ -93,6 +94,12 @@ def main() -> None:
|
|
|
93
94
|
action='store_true',
|
|
94
95
|
help='Enable dry run mode to check without saving',
|
|
95
96
|
)
|
|
97
|
+
group.add_argument(
|
|
98
|
+
'--dump',
|
|
99
|
+
dest='dump',
|
|
100
|
+
action='store_true',
|
|
101
|
+
help='Dump Python objects of groups and projects',
|
|
102
|
+
)
|
|
96
103
|
group.add_argument(
|
|
97
104
|
'--exclude-group',
|
|
98
105
|
dest='exclude_group',
|
|
@@ -216,7 +223,10 @@ def main() -> None:
|
|
|
216
223
|
dest='protect_tags',
|
|
217
224
|
action='store',
|
|
218
225
|
metavar='LEVEL',
|
|
219
|
-
|
|
226
|
+
nargs='?',
|
|
227
|
+
const=ProtectionLevels.default(),
|
|
228
|
+
help=f'Protect tags at level [{",".join(ProtectionLevels.names())}]'
|
|
229
|
+
' (default: %(const)s)',
|
|
220
230
|
)
|
|
221
231
|
|
|
222
232
|
# Arguments positional definitions
|
|
@@ -232,7 +242,7 @@ def main() -> None:
|
|
|
232
242
|
action='store',
|
|
233
243
|
nargs='?',
|
|
234
244
|
default='https://gitlab.com',
|
|
235
|
-
help='GitLab URL (default:
|
|
245
|
+
help='GitLab URL (default: %(default)s)',
|
|
236
246
|
)
|
|
237
247
|
group.add_argument(
|
|
238
248
|
dest='path',
|
|
@@ -288,18 +298,19 @@ def main() -> None:
|
|
|
288
298
|
|
|
289
299
|
# Arguments validation
|
|
290
300
|
if not options.token or not options.gitlab or not options.path:
|
|
291
|
-
|
|
292
|
-
parser.print_help()
|
|
293
|
-
print(' ')
|
|
294
|
-
Platform.flush()
|
|
295
|
-
sys_exit(1)
|
|
301
|
+
result = Entrypoint.Result.CRITICAL
|
|
296
302
|
|
|
297
303
|
# Header
|
|
298
304
|
print(' ')
|
|
299
305
|
Platform.flush()
|
|
300
306
|
|
|
301
307
|
# CLI entrypoint
|
|
302
|
-
result
|
|
308
|
+
if result != Entrypoint.Result.CRITICAL:
|
|
309
|
+
result = Entrypoint.cli(options)
|
|
310
|
+
|
|
311
|
+
# CLI helper
|
|
312
|
+
else:
|
|
313
|
+
parser.print_help()
|
|
303
314
|
|
|
304
315
|
# Footer
|
|
305
316
|
print(' ')
|
|
@@ -10,7 +10,7 @@ from gitlab.exceptions import GitlabDeleteError, GitlabGetError, GitlabListError
|
|
|
10
10
|
from gitlab.v4.objects import Group, Namespace, Project, User
|
|
11
11
|
|
|
12
12
|
# Components
|
|
13
|
-
from ..types.gitlab import AccessLevels, ProjectFeatures
|
|
13
|
+
from ..types.gitlab import AccessLevels, ProjectFeatures, ProtectionLevels
|
|
14
14
|
|
|
15
15
|
# GitLabFeature class, pylint: disable=too-many-public-methods
|
|
16
16
|
class GitLabFeature:
|
|
@@ -349,13 +349,13 @@ class GitLabFeature:
|
|
|
349
349
|
|
|
350
350
|
# Prepare access level
|
|
351
351
|
access_level: int
|
|
352
|
-
if protect_level ==
|
|
352
|
+
if protect_level == ProtectionLevels.NO_ONE:
|
|
353
353
|
access_level = 0
|
|
354
|
-
elif protect_level ==
|
|
354
|
+
elif protect_level == ProtectionLevels.ADMINS:
|
|
355
355
|
access_level = 60
|
|
356
|
-
elif protect_level ==
|
|
356
|
+
elif protect_level == ProtectionLevels.MAINTAINERS:
|
|
357
357
|
access_level = 40
|
|
358
|
-
elif protect_level ==
|
|
358
|
+
elif protect_level == ProtectionLevels.DEVELOPERS:
|
|
359
359
|
access_level = 30
|
|
360
360
|
else:
|
|
361
361
|
raise SyntaxError(f'Unknown protection level: {access_level}')
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
# Modules libraries
|
|
4
|
+
try:
|
|
5
|
+
from prompt_toolkit.styles.style import Style as prompt_toolkit_styles_Style
|
|
6
|
+
except ModuleNotFoundError: # pragma: no cover
|
|
7
|
+
from typing import Any as prompt_toolkit_styles_Style # type: ignore[assignment]
|
|
8
|
+
|
|
9
|
+
# Components
|
|
10
|
+
from .colors import Colors
|
|
11
|
+
|
|
12
|
+
# Themes class, pylint: disable=too-few-public-methods
|
|
13
|
+
class Themes:
|
|
14
|
+
|
|
15
|
+
# Flags
|
|
16
|
+
__prepared = False
|
|
17
|
+
|
|
18
|
+
# Members
|
|
19
|
+
__bold: str = ''
|
|
20
|
+
__red: str = ''
|
|
21
|
+
__selected: str = ''
|
|
22
|
+
|
|
23
|
+
# Prepare
|
|
24
|
+
@staticmethod
|
|
25
|
+
def __prepare() -> None:
|
|
26
|
+
|
|
27
|
+
# Colors enabled
|
|
28
|
+
if Colors.enabled():
|
|
29
|
+
Themes.__bold = 'bold'
|
|
30
|
+
Themes.__red = '#FF0000 bold'
|
|
31
|
+
Themes.__selected = 'bold noreverse'
|
|
32
|
+
|
|
33
|
+
# Colors disabled
|
|
34
|
+
else:
|
|
35
|
+
Themes.__bold = 'noinherit bold'
|
|
36
|
+
Themes.__red = 'noinherit bold'
|
|
37
|
+
Themes.__selected = 'noinherit bold noreverse'
|
|
38
|
+
|
|
39
|
+
# Raise flag
|
|
40
|
+
Themes.__prepared = True
|
|
41
|
+
|
|
42
|
+
# Confirmation
|
|
43
|
+
@staticmethod
|
|
44
|
+
def confirmation_style() -> prompt_toolkit_styles_Style:
|
|
45
|
+
|
|
46
|
+
# Prepare
|
|
47
|
+
if not Themes.__prepared:
|
|
48
|
+
Themes.__prepare()
|
|
49
|
+
|
|
50
|
+
# Result
|
|
51
|
+
return prompt_toolkit_styles_Style([
|
|
52
|
+
('answer', Themes.__red),
|
|
53
|
+
('instruction', Themes.__red),
|
|
54
|
+
('highlighted', Themes.__bold),
|
|
55
|
+
('pointer', Themes.__bold),
|
|
56
|
+
('qmark', Themes.__bold),
|
|
57
|
+
('question', Themes.__bold),
|
|
58
|
+
('selected', Themes.__selected),
|
|
59
|
+
('separator', Themes.__bold),
|
|
60
|
+
])
|
|
@@ -14,6 +14,28 @@ class AccessLevels:
|
|
|
14
14
|
PRIVATE: str = 'private'
|
|
15
15
|
ENABLED: str = 'enabled'
|
|
16
16
|
|
|
17
|
+
# ProtectionLevels class
|
|
18
|
+
class ProtectionLevels:
|
|
19
|
+
NO_ONE: str = 'no-one'
|
|
20
|
+
ADMINS: str = 'admins'
|
|
21
|
+
MAINTAINERS: str = 'maintainers'
|
|
22
|
+
DEVELOPERS: str = 'developers'
|
|
23
|
+
|
|
24
|
+
# Default
|
|
25
|
+
@staticmethod
|
|
26
|
+
def default() -> str:
|
|
27
|
+
return ProtectionLevels.NO_ONE
|
|
28
|
+
|
|
29
|
+
# Names
|
|
30
|
+
@staticmethod
|
|
31
|
+
def names() -> List[str]:
|
|
32
|
+
return [
|
|
33
|
+
ProtectionLevels.NO_ONE,
|
|
34
|
+
ProtectionLevels.ADMINS,
|
|
35
|
+
ProtectionLevels.MAINTAINERS,
|
|
36
|
+
ProtectionLevels.DEVELOPERS,
|
|
37
|
+
]
|
|
38
|
+
|
|
17
39
|
# Visibility class, pylint: disable=too-few-public-methods
|
|
18
40
|
class Visibility:
|
|
19
41
|
PRIVATE: str = 'private'
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|