midpoint-cli 1.3.1__tar.gz → 1.4.0.dev6__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.
Files changed (48) hide show
  1. {midpoint_cli-1.3.1/midpoint_cli.egg-info → midpoint_cli-1.4.0.dev6}/PKG-INFO +55 -39
  2. {midpoint_cli-1.3.1 → midpoint_cli-1.4.0.dev6}/README.md +35 -27
  3. midpoint_cli-1.4.0.dev6/pyproject.toml +139 -0
  4. midpoint_cli-1.4.0.dev6/src/midpoint_cli/__init__.py +83 -0
  5. midpoint_cli-1.4.0.dev6/src/midpoint_cli/client/__init__.py +240 -0
  6. midpoint_cli-1.4.0.dev6/src/midpoint_cli/client/objects.py +364 -0
  7. midpoint_cli-1.4.0.dev6/src/midpoint_cli/client/observer.py +26 -0
  8. {midpoint_cli-1.3.1 → midpoint_cli-1.4.0.dev6}/src/midpoint_cli/client/patch.py +1 -1
  9. midpoint_cli-1.4.0.dev6/src/midpoint_cli/client/progress.py +33 -0
  10. {midpoint_cli-1.3.1 → midpoint_cli-1.4.0.dev6}/src/midpoint_cli/client/session.py +8 -11
  11. {midpoint_cli-1.3.1 → midpoint_cli-1.4.0.dev6}/src/midpoint_cli/prompt/__init__.py +13 -16
  12. midpoint_cli-1.4.0.dev6/src/midpoint_cli/prompt/base.py +13 -0
  13. {midpoint_cli-1.3.1 → midpoint_cli-1.4.0.dev6}/src/midpoint_cli/prompt/complete.py +5 -7
  14. {midpoint_cli-1.3.1 → midpoint_cli-1.4.0.dev6}/src/midpoint_cli/prompt/configuration.py +4 -4
  15. midpoint_cli-1.4.0.dev6/src/midpoint_cli/prompt/console.py +196 -0
  16. {midpoint_cli-1.3.1 → midpoint_cli-1.4.0.dev6}/src/midpoint_cli/prompt/delete.py +2 -4
  17. {midpoint_cli-1.3.1 → midpoint_cli-1.4.0.dev6}/src/midpoint_cli/prompt/get.py +9 -6
  18. {midpoint_cli-1.3.1 → midpoint_cli-1.4.0.dev6}/src/midpoint_cli/prompt/org.py +3 -4
  19. {midpoint_cli-1.3.1 → midpoint_cli-1.4.0.dev6}/src/midpoint_cli/prompt/put.py +6 -8
  20. {midpoint_cli-1.3.1 → midpoint_cli-1.4.0.dev6}/src/midpoint_cli/prompt/resource.py +7 -5
  21. {midpoint_cli-1.3.1 → midpoint_cli-1.4.0.dev6}/src/midpoint_cli/prompt/script.py +7 -11
  22. {midpoint_cli-1.3.1 → midpoint_cli-1.4.0.dev6}/src/midpoint_cli/prompt/task.py +23 -10
  23. {midpoint_cli-1.3.1 → midpoint_cli-1.4.0.dev6}/src/midpoint_cli/prompt/user.py +5 -4
  24. midpoint_cli-1.3.1/MANIFEST.in +0 -1
  25. midpoint_cli-1.3.1/PKG-INFO +0 -236
  26. midpoint_cli-1.3.1/midpoint_cli.egg-info/SOURCES.txt +0 -39
  27. midpoint_cli-1.3.1/midpoint_cli.egg-info/dependency_links.txt +0 -1
  28. midpoint_cli-1.3.1/midpoint_cli.egg-info/requires.txt +0 -6
  29. midpoint_cli-1.3.1/midpoint_cli.egg-info/top_level.txt +0 -1
  30. midpoint_cli-1.3.1/requirements.txt +0 -7
  31. midpoint_cli-1.3.1/setup.cfg +0 -7
  32. midpoint_cli-1.3.1/setup.py +0 -47
  33. midpoint_cli-1.3.1/src/midpoint-cli +0 -67
  34. midpoint_cli-1.3.1/src/midpoint_cli/__init__.py +0 -1
  35. midpoint_cli-1.3.1/src/midpoint_cli/client/__init__.py +0 -228
  36. midpoint_cli-1.3.1/src/midpoint_cli/client/objects.py +0 -220
  37. midpoint_cli-1.3.1/src/midpoint_cli/client/observer.py +0 -10
  38. midpoint_cli-1.3.1/src/midpoint_cli/client/progress.py +0 -26
  39. midpoint_cli-1.3.1/src/midpoint_cli/prompt/base.py +0 -5
  40. midpoint_cli-1.3.1/src/midpoint_cli/prompt/console.py +0 -21
  41. midpoint_cli-1.3.1/test/test_client_api.py +0 -43
  42. midpoint_cli-1.3.1/test/test_client_model.py +0 -39
  43. midpoint_cli-1.3.1/test/test_client_put.py +0 -44
  44. midpoint_cli-1.3.1/test/test_environment.py +0 -54
  45. midpoint_cli-1.3.1/test/test_parser.py +0 -62
  46. midpoint_cli-1.3.1/test/test_patch.py +0 -30
  47. midpoint_cli-1.3.1/test/test_script.py +0 -49
  48. {midpoint_cli-1.3.1 → midpoint_cli-1.4.0.dev6}/LICENSE +0 -0
@@ -1,25 +1,32 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: midpoint-cli
3
- Version: 1.3.1
3
+ Version: 1.4.0.dev6
4
4
  Summary: A command line client to Midpoint Identity Management system.
5
- Home-page: https://gitlab.com/alcibiade/midpoint-cli
5
+ License: MIT
6
+ License-File: LICENSE
6
7
  Author: Yannick Kirschhoffer
7
8
  Author-email: alcibiade@alcibiade.org
8
- License: MIT
9
+ Maintainer: Yannick Kirschhoffer
10
+ Maintainer-email: alcibiade@alcibiade.org
11
+ Requires-Python: >=3.9.0,<4.0.0
9
12
  Classifier: Development Status :: 5 - Production/Stable
10
13
  Classifier: Intended Audience :: Developers
11
14
  Classifier: Intended Audience :: System Administrators
12
- Classifier: Topic :: System :: Systems Administration
13
15
  Classifier: License :: OSI Approved :: MIT License
14
16
  Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
23
+ Classifier: Topic :: System :: Systems Administration
24
+ Requires-Dist: requests (>=2.31,<3.0)
25
+ Requires-Dist: tabulate (>=0.9,<0.10)
26
+ Requires-Dist: unidecode (>=1.3,<2.0)
27
+ Requires-Dist: urllib3 (>=2.0,<3.0)
28
+ Project-URL: Repository, https://gitlab.com/alcibiade/midpoint-cli
15
29
  Description-Content-Type: text/markdown
16
- License-File: LICENSE
17
- Requires-Dist: clint>=0.5
18
- Requires-Dist: tabulate>=0.9
19
- Requires-Dist: unidecode>=1.3
20
- Requires-Dist: requests>=2.31
21
- Requires-Dist: urllib3>=2.0
22
- Requires-Dist: setuptools>=68.0
23
30
 
24
31
  ![link=https://badge.fury.io/py/midpoint-cli](https://badge.fury.io/py/midpoint-cli.svg)
25
32
 
@@ -43,9 +50,9 @@ The client currently supports:
43
50
 
44
51
  Features currently under development:
45
52
 
46
- * Auto completion to search of IDs or task names
53
+ * Auto-completion to search of IDs or task names
47
54
  * Improved task results display: retrieve and display a human readable status output
48
- * Any other tasks that would be sumbitted in the issue tracker of this project on Gitlab
55
+ * Any other tasks that would be submitted in the issue tracker of this project on Gitlab
49
56
 
50
57
  The strong points of this project are:
51
58
 
@@ -144,6 +151,10 @@ Successfully installed args-0.1.0 certifi-2019.9.11 chardet-3.0.4 clint-0.5.1 id
144
151
 
145
152
  ### Development build
146
153
 
154
+ Dependency management, build and test is managed using Python Poetry.
155
+
156
+ To install Poetry, please refer to [the official Python Poetry website](https://python-poetry.org/).
157
+
147
158
  To install the current development version from GIT:
148
159
 
149
160
  ```bash
@@ -156,30 +167,34 @@ remote: Total 374 (delta 229), reused 299 (delta 175)
156
167
  Receiving objects: 100% (374/374), 62.84 KiB | 0 bytes/s, done.
157
168
  Resolving deltas: 100% (229/229), done.
158
169
 
159
- yk@lunar:~/dev$ pip3 install midpoint-cli/
160
- Processing ./midpoint-cli
161
- Collecting clint (from midpoint-cli===0.8-snapshot)
162
- Collecting requests (from midpoint-cli===0.8-snapshot)
163
- Using cached https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl
164
- Collecting tabulate (from midpoint-cli===0.8-snapshot)
165
- Collecting args (from clint->midpoint-cli===0.8-snapshot)
166
- Collecting chardet<3.1.0,>=3.0.2 (from requests->midpoint-cli===0.8-snapshot)
167
- Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
168
- Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests->midpoint-cli===0.8-snapshot)
169
- Using cached https://files.pythonhosted.org/packages/e0/da/55f51ea951e1b7c63a579c09dd7db825bb730ec1fe9c0180fc77bfb31448/urllib3-1.25.6-py2.py3-none-any.whl
170
- Collecting certifi>=2017.4.17 (from requests->midpoint-cli===0.8-snapshot)
171
- Using cached https://files.pythonhosted.org/packages/18/b0/8146a4f8dd402f60744fa380bc73ca47303cccf8b9190fd16a827281eac2/certifi-2019.9.11-py2.py3-none-any.whl
172
- Collecting idna<2.9,>=2.5 (from requests->midpoint-cli===0.8-snapshot)
173
- Using cached https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl
174
- Building wheels for collected packages: midpoint-cli
175
- Running setup.py bdist_wheel for midpoint-cli ... done
176
- Stored in directory: /home/yk/.cache/pip/wheels/2a/5a/d6/54312f2db19e2a44cea90e4e1c186e7c1beb7192b4974db759
177
- Successfully built midpoint-cli
178
- Installing collected packages: args, clint, chardet, urllib3, certifi, idna, requests, tabulate, midpoint-cli
179
- Successfully installed args-0.1.0 certifi-2019.9.11 chardet-3.0.4 clint-0.5.1 idna-2.8 midpoint-cli-0.7.0 requests-2.22.0 tabulate-0.8.5 urllib3-1.25.6
170
+ yk@lunar:~/dev$ poetry install
171
+ Creating virtualenv midpoint-cli-54EjqR0S-py3.12 in /home/yk/.cache/pypoetry/virtualenvs
172
+ Updating dependencies
173
+ Resolving dependencies... (5.1s)
174
+
175
+ Package operations: 13 installs, 0 updates, 0 removals
176
+
177
+ - Installing args (0.1.0)
178
+ - Installing certifi (2024.8.30)
179
+ - Installing charset-normalizer (3.3.2)
180
+ - Installing idna (3.10)
181
+ - Installing iniconfig (2.0.0)
182
+ - Installing packaging (24.1)
183
+ - Installing pluggy (1.5.0)
184
+ - Installing urllib3 (2.2.3)
185
+ - Installing clint (0.5.1)
186
+ - Installing pytest (8.3.3)
187
+ - Installing requests (2.32.3)
188
+ - Installing tabulate (0.9.0)
189
+ - Installing unidecode (1.3.8)
190
+
191
+ Writing lock file
192
+
193
+ Installing the current project: midpoint-cli (1.4.0.dev2)
194
+
195
+ yk@lunar:~/dev$ poetry run midpoint-cli --version
196
+ Midpoint CLI Version 1.4.0.dev2
180
197
 
181
- yk@lunar:~/dev$ midpoint-cli -v
182
- Midpoint CLI Version 0.8-snapshot
183
198
  ```
184
199
 
185
200
  ### Anaconda
@@ -232,5 +247,6 @@ midpoint-1
232
247
  * Update revision in src/midpoint_cli/__init__.py
233
248
  * Commit and tag with corresponding version number
234
249
  * Generate markdown documentation: downdoc README.adoc
235
- * Build distribution: python setup.py sdist
236
- * Upload distribution to PyPI: twine upload dist/*
250
+ * Build distribution: poetry build
251
+ * Upload distribution to PyPI: poetry publish
252
+
@@ -20,9 +20,9 @@ The client currently supports:
20
20
 
21
21
  Features currently under development:
22
22
 
23
- * Auto completion to search of IDs or task names
23
+ * Auto-completion to search of IDs or task names
24
24
  * Improved task results display: retrieve and display a human readable status output
25
- * Any other tasks that would be sumbitted in the issue tracker of this project on Gitlab
25
+ * Any other tasks that would be submitted in the issue tracker of this project on Gitlab
26
26
 
27
27
  The strong points of this project are:
28
28
 
@@ -121,6 +121,10 @@ Successfully installed args-0.1.0 certifi-2019.9.11 chardet-3.0.4 clint-0.5.1 id
121
121
 
122
122
  ### Development build
123
123
 
124
+ Dependency management, build and test is managed using Python Poetry.
125
+
126
+ To install Poetry, please refer to [the official Python Poetry website](https://python-poetry.org/).
127
+
124
128
  To install the current development version from GIT:
125
129
 
126
130
  ```bash
@@ -133,30 +137,34 @@ remote: Total 374 (delta 229), reused 299 (delta 175)
133
137
  Receiving objects: 100% (374/374), 62.84 KiB | 0 bytes/s, done.
134
138
  Resolving deltas: 100% (229/229), done.
135
139
 
136
- yk@lunar:~/dev$ pip3 install midpoint-cli/
137
- Processing ./midpoint-cli
138
- Collecting clint (from midpoint-cli===0.8-snapshot)
139
- Collecting requests (from midpoint-cli===0.8-snapshot)
140
- Using cached https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl
141
- Collecting tabulate (from midpoint-cli===0.8-snapshot)
142
- Collecting args (from clint->midpoint-cli===0.8-snapshot)
143
- Collecting chardet<3.1.0,>=3.0.2 (from requests->midpoint-cli===0.8-snapshot)
144
- Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
145
- Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests->midpoint-cli===0.8-snapshot)
146
- Using cached https://files.pythonhosted.org/packages/e0/da/55f51ea951e1b7c63a579c09dd7db825bb730ec1fe9c0180fc77bfb31448/urllib3-1.25.6-py2.py3-none-any.whl
147
- Collecting certifi>=2017.4.17 (from requests->midpoint-cli===0.8-snapshot)
148
- Using cached https://files.pythonhosted.org/packages/18/b0/8146a4f8dd402f60744fa380bc73ca47303cccf8b9190fd16a827281eac2/certifi-2019.9.11-py2.py3-none-any.whl
149
- Collecting idna<2.9,>=2.5 (from requests->midpoint-cli===0.8-snapshot)
150
- Using cached https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl
151
- Building wheels for collected packages: midpoint-cli
152
- Running setup.py bdist_wheel for midpoint-cli ... done
153
- Stored in directory: /home/yk/.cache/pip/wheels/2a/5a/d6/54312f2db19e2a44cea90e4e1c186e7c1beb7192b4974db759
154
- Successfully built midpoint-cli
155
- Installing collected packages: args, clint, chardet, urllib3, certifi, idna, requests, tabulate, midpoint-cli
156
- Successfully installed args-0.1.0 certifi-2019.9.11 chardet-3.0.4 clint-0.5.1 idna-2.8 midpoint-cli-0.7.0 requests-2.22.0 tabulate-0.8.5 urllib3-1.25.6
140
+ yk@lunar:~/dev$ poetry install
141
+ Creating virtualenv midpoint-cli-54EjqR0S-py3.12 in /home/yk/.cache/pypoetry/virtualenvs
142
+ Updating dependencies
143
+ Resolving dependencies... (5.1s)
144
+
145
+ Package operations: 13 installs, 0 updates, 0 removals
146
+
147
+ - Installing args (0.1.0)
148
+ - Installing certifi (2024.8.30)
149
+ - Installing charset-normalizer (3.3.2)
150
+ - Installing idna (3.10)
151
+ - Installing iniconfig (2.0.0)
152
+ - Installing packaging (24.1)
153
+ - Installing pluggy (1.5.0)
154
+ - Installing urllib3 (2.2.3)
155
+ - Installing clint (0.5.1)
156
+ - Installing pytest (8.3.3)
157
+ - Installing requests (2.32.3)
158
+ - Installing tabulate (0.9.0)
159
+ - Installing unidecode (1.3.8)
160
+
161
+ Writing lock file
162
+
163
+ Installing the current project: midpoint-cli (1.4.0.dev2)
164
+
165
+ yk@lunar:~/dev$ poetry run midpoint-cli --version
166
+ Midpoint CLI Version 1.4.0.dev2
157
167
 
158
- yk@lunar:~/dev$ midpoint-cli -v
159
- Midpoint CLI Version 0.8-snapshot
160
168
  ```
161
169
 
162
170
  ### Anaconda
@@ -209,5 +217,5 @@ midpoint-1
209
217
  * Update revision in src/midpoint_cli/__init__.py
210
218
  * Commit and tag with corresponding version number
211
219
  * Generate markdown documentation: downdoc README.adoc
212
- * Build distribution: python setup.py sdist
213
- * Upload distribution to PyPI: twine upload dist/*
220
+ * Build distribution: poetry build
221
+ * Upload distribution to PyPI: poetry publish
@@ -0,0 +1,139 @@
1
+ [build-system]
2
+ requires = ["poetry-core"]
3
+ build-backend = "poetry.core.masonry.api"
4
+
5
+ [tool.poetry]
6
+ name = "midpoint-cli"
7
+ version = "1.4.0.dev6"
8
+ description = "A command line client to Midpoint Identity Management system."
9
+ readme = "README.md"
10
+
11
+ license = "MIT"
12
+ authors = ["Yannick Kirschhoffer <alcibiade@alcibiade.org>"]
13
+ maintainers = ["Yannick Kirschhoffer <alcibiade@alcibiade.org>"]
14
+ repository = "https://gitlab.com/alcibiade/midpoint-cli"
15
+
16
+ packages = [
17
+ { include = "midpoint_cli", from = "src" }
18
+ ]
19
+
20
+ classifiers = [
21
+ "Development Status :: 5 - Production/Stable",
22
+ "Intended Audience :: Developers",
23
+ "Intended Audience :: System Administrators",
24
+ "Topic :: System :: Systems Administration",
25
+ "License :: OSI Approved :: MIT License",
26
+ "Programming Language :: Python :: 3",
27
+ "Programming Language :: Python :: 3.9",
28
+ "Programming Language :: Python :: 3.10",
29
+ "Programming Language :: Python :: 3.11",
30
+ "Programming Language :: Python :: 3.12",
31
+ "Programming Language :: Python :: 3.13"
32
+ ]
33
+
34
+ [tool.poetry.scripts]
35
+ midpoint-cli = 'midpoint_cli:main'
36
+
37
+ [tool.poetry.dependencies]
38
+ python = "^3.9.0"
39
+ tabulate = "^0.9"
40
+ unidecode = "^1.3"
41
+ requests = "^2.31"
42
+ urllib3 = "^2.0"
43
+
44
+ [tool.poetry.group.test.dependencies]
45
+ pytest = "*"
46
+
47
+ [tool.poetry.group.dev.dependencies]
48
+ pytest-cov = "*"
49
+ ruff = "*"
50
+ mypy = "*"
51
+
52
+ [tool.ruff]
53
+ target-version = "py39"
54
+ line-length = 120
55
+ exclude = [
56
+ ".git",
57
+ ".pytest_cache",
58
+ ".ruff_cache",
59
+ "__pycache__",
60
+ "build",
61
+ "dist",
62
+ "venv",
63
+ ".venv",
64
+ ]
65
+
66
+ [tool.ruff.lint]
67
+ select = [
68
+ "E", # pycodestyle errors
69
+ "W", # pycodestyle warnings
70
+ "F", # pyflakes
71
+ "I", # isort
72
+ "B", # flake8-bugbear
73
+ "C4", # flake8-comprehensions
74
+ "UP", # pyupgrade
75
+ ]
76
+ ignore = [
77
+ "E501", # line too long (handled by formatter)
78
+ ]
79
+
80
+ [tool.ruff.format]
81
+ quote-style = "single"
82
+ indent-style = "space"
83
+ skip-magic-trailing-comma = false
84
+ line-ending = "auto"
85
+
86
+ [tool.mypy]
87
+ python_version = "3.9"
88
+ warn_return_any = true
89
+ warn_unused_configs = true
90
+ disallow_untyped_defs = false
91
+ disallow_incomplete_defs = false
92
+ check_untyped_defs = true
93
+ disallow_untyped_decorators = false
94
+ warn_redundant_casts = true
95
+ warn_unused_ignores = true
96
+ warn_no_return = true
97
+ warn_unreachable = true
98
+ strict_equality = true
99
+ show_error_codes = true
100
+
101
+ [[tool.mypy.overrides]]
102
+ module = [
103
+ "tabulate.*",
104
+ "unidecode.*",
105
+ "requests.*",
106
+ "urllib3.*",
107
+ ]
108
+ ignore_missing_imports = true
109
+
110
+ [tool.coverage.run]
111
+ source = ["src"]
112
+ branch = true
113
+ omit = [
114
+ "*/tests/*",
115
+ "*/test/*",
116
+ "*/__pycache__/*",
117
+ "*/venv/*",
118
+ "*/.venv/*",
119
+ ]
120
+
121
+ [tool.coverage.report]
122
+ exclude_lines = [
123
+ "pragma: no cover",
124
+ "def __repr__",
125
+ "if self.debug:",
126
+ "if settings.DEBUG",
127
+ "raise AssertionError",
128
+ "raise NotImplementedError",
129
+ "if 0:",
130
+ "if __name__ == .__main__.:",
131
+ "class .*\\bProtocol\\):",
132
+ "@(abc\\.)?abstractmethod",
133
+ ]
134
+ show_missing = true
135
+ skip_covered = false
136
+ precision = 2
137
+
138
+ [tool.coverage.html]
139
+ directory = "coverage_html_report"
@@ -0,0 +1,83 @@
1
+ import importlib
2
+ import importlib.metadata
3
+ import logging
4
+ import os
5
+ import sys
6
+ from argparse import ArgumentParser, RawTextHelpFormatter
7
+ from configparser import ConfigParser
8
+
9
+ from midpoint_cli.client import MidpointClient
10
+ from midpoint_cli.prompt import MidpointClientPrompt
11
+ from midpoint_cli.prompt.configuration import compute_client_configuration
12
+ from midpoint_cli.prompt.console import ConsoleDisplay
13
+
14
+
15
+ def main():
16
+ logging.basicConfig(level=logging.INFO)
17
+ logging.getLogger('urllib3.connectionpool').setLevel(logging.ERROR)
18
+
19
+ version = importlib.metadata.version('midpoint_cli')
20
+
21
+ MIDPOINT_ENVIRONMENT_VARS = ['MIDPOINT_URL', 'MIDPOINT_USERNAME', 'MIDPOINT_PASSWORD']
22
+
23
+ argument_parser = ArgumentParser(
24
+ description='An interactive Midpoint command line client.',
25
+ formatter_class=RawTextHelpFormatter,
26
+ epilog="""
27
+ Available commands:
28
+ get Get an XML definition from the server from an existing OID reference.
29
+ put Create/Update a server object based on an XML structure.
30
+ delete Delete a server object based on its type and OID.
31
+
32
+ task Manage server tasks.
33
+ resource Manage resources on the server.
34
+
35
+ org Manage organizations.
36
+ user Manage users.
37
+
38
+ Server URL and credentials can also be stored in ~/.midpoint-cli.cfg, or read from environment variables MIDPOINT_URL,
39
+ MIDPOINT_USERNAME and MIDPOINT_PASSWORD.
40
+
41
+ Midpoint-cli version """
42
+ + version
43
+ + """, created and maintained by Yannick Kirschhoffer alcibiade@alcibiade.org
44
+ """,
45
+ )
46
+ argument_parser.add_argument(
47
+ '-v', '--version', help='Set the username to authenticate this session.', action='store_true'
48
+ )
49
+ argument_parser.add_argument(
50
+ '-u', '--username', help='Set the username to authenticate this session.', default=None
51
+ )
52
+ argument_parser.add_argument(
53
+ '-p', '--password', help='Set the password to authenticate this session.', default=None
54
+ )
55
+ argument_parser.add_argument('-U', '--url', help='Midpoint base URL', default=None)
56
+ argument_parser.add_argument('command', help='Optional command to be executed immediately.', nargs='?')
57
+ argument_parser.add_argument('arg', help='Optional command arguments.', nargs='*')
58
+
59
+ argument_namespace = argument_parser.parse_args(sys.argv[1:])
60
+
61
+ if argument_namespace.version:
62
+ print(f'Midpoint CLI Version {version}')
63
+ sys.exit(0)
64
+
65
+ config_parser = ConfigParser()
66
+ config_parser.read(['midpoint-cli.cfg', os.path.expanduser('~/.midpoint-cli.cfg')])
67
+
68
+ client_configuration = compute_client_configuration(
69
+ argument_namespace, config_parser, [os.getenv(v) for v in MIDPOINT_ENVIRONMENT_VARS]
70
+ )
71
+
72
+ client = MidpointClient(client_configuration, observer=ConsoleDisplay())
73
+ prompt = MidpointClientPrompt(client)
74
+
75
+ if argument_namespace.command is not None:
76
+ prompt.onecmd(argument_namespace.command + ' ' + ' '.join(argument_namespace.arg))
77
+ sys.exit(prompt.error_code)
78
+ else:
79
+ prompt.cmdloop()
80
+
81
+
82
+ if __name__ == '__main__':
83
+ main()