midpoint-cli 1.3.0__tar.gz → 1.4.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.
Files changed (47) hide show
  1. {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/PKG-INFO +60 -33
  2. {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/README.md +37 -27
  3. midpoint_cli-1.4.0/pyproject.toml +143 -0
  4. midpoint_cli-1.4.0/src/midpoint_cli/__init__.py +83 -0
  5. midpoint_cli-1.4.0/src/midpoint_cli/client/__init__.py +240 -0
  6. midpoint_cli-1.4.0/src/midpoint_cli/client/objects.py +364 -0
  7. midpoint_cli-1.4.0/src/midpoint_cli/client/observer.py +26 -0
  8. {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/src/midpoint_cli/client/patch.py +1 -1
  9. midpoint_cli-1.4.0/src/midpoint_cli/client/progress.py +33 -0
  10. {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/src/midpoint_cli/client/session.py +8 -11
  11. midpoint_cli-1.4.0/src/midpoint_cli/prompt/__init__.py +165 -0
  12. midpoint_cli-1.4.0/src/midpoint_cli/prompt/base.py +13 -0
  13. {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/src/midpoint_cli/prompt/complete.py +5 -7
  14. {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/src/midpoint_cli/prompt/configuration.py +4 -4
  15. midpoint_cli-1.4.0/src/midpoint_cli/prompt/console.py +297 -0
  16. {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/src/midpoint_cli/prompt/delete.py +2 -4
  17. {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/src/midpoint_cli/prompt/get.py +12 -8
  18. {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/src/midpoint_cli/prompt/org.py +35 -8
  19. {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/src/midpoint_cli/prompt/put.py +6 -8
  20. {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/src/midpoint_cli/prompt/resource.py +56 -11
  21. {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/src/midpoint_cli/prompt/script.py +7 -11
  22. {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/src/midpoint_cli/prompt/task.py +71 -20
  23. {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/src/midpoint_cli/prompt/user.py +42 -9
  24. midpoint-cli-1.3.0/midpoint_cli.egg-info/PKG-INFO +0 -228
  25. midpoint-cli-1.3.0/midpoint_cli.egg-info/SOURCES.txt +0 -37
  26. midpoint-cli-1.3.0/midpoint_cli.egg-info/dependency_links.txt +0 -1
  27. midpoint-cli-1.3.0/midpoint_cli.egg-info/requires.txt +0 -6
  28. midpoint-cli-1.3.0/midpoint_cli.egg-info/top_level.txt +0 -1
  29. midpoint-cli-1.3.0/setup.cfg +0 -7
  30. midpoint-cli-1.3.0/setup.py +0 -47
  31. midpoint-cli-1.3.0/src/midpoint-cli +0 -67
  32. midpoint-cli-1.3.0/src/midpoint_cli/__init__.py +0 -1
  33. midpoint-cli-1.3.0/src/midpoint_cli/client/__init__.py +0 -228
  34. midpoint-cli-1.3.0/src/midpoint_cli/client/objects.py +0 -215
  35. midpoint-cli-1.3.0/src/midpoint_cli/client/observer.py +0 -10
  36. midpoint-cli-1.3.0/src/midpoint_cli/client/progress.py +0 -26
  37. midpoint-cli-1.3.0/src/midpoint_cli/prompt/__init__.py +0 -63
  38. midpoint-cli-1.3.0/src/midpoint_cli/prompt/base.py +0 -5
  39. midpoint-cli-1.3.0/src/midpoint_cli/prompt/console.py +0 -21
  40. midpoint-cli-1.3.0/test/test_client_api.py +0 -43
  41. midpoint-cli-1.3.0/test/test_client_model.py +0 -39
  42. midpoint-cli-1.3.0/test/test_client_put.py +0 -44
  43. midpoint-cli-1.3.0/test/test_environment.py +0 -54
  44. midpoint-cli-1.3.0/test/test_parser.py +0 -62
  45. midpoint-cli-1.3.0/test/test_patch.py +0 -30
  46. midpoint-cli-1.3.0/test/test_script.py +0 -49
  47. {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/LICENSE +0 -0
@@ -1,19 +1,37 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: midpoint-cli
3
- Version: 1.3.0
3
+ Version: 1.4.0
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: prompt-toolkit (>=3.0,<4.0)
25
+ Requires-Dist: pygments (>=2.0,<3.0)
26
+ Requires-Dist: requests (>=2.31,<3.0)
27
+ Requires-Dist: rich (>=13.0,<14.0)
28
+ Requires-Dist: tabulate (>=0.9,<0.10)
29
+ Requires-Dist: unidecode (>=1.3,<2.0)
30
+ Requires-Dist: urllib3 (>=2.0,<3.0)
31
+ Project-URL: Repository, https://gitlab.com/alcibiade/midpoint-cli
15
32
  Description-Content-Type: text/markdown
16
- License-File: LICENSE
33
+
34
+ ![link=https://badge.fury.io/py/midpoint-cli](https://badge.fury.io/py/midpoint-cli.svg)
17
35
 
18
36
  ## Midpoint CLI
19
37
 
@@ -35,9 +53,9 @@ The client currently supports:
35
53
 
36
54
  Features currently under development:
37
55
 
38
- * Auto completion to search of IDs or task names
56
+ * Auto-completion to search of IDs or task names
39
57
  * Improved task results display: retrieve and display a human readable status output
40
- * Any other tasks that would be sumbitted in the issue tracker of this project on Gitlab
58
+ * Any other tasks that would be submitted in the issue tracker of this project on Gitlab
41
59
 
42
60
  The strong points of this project are:
43
61
 
@@ -136,6 +154,10 @@ Successfully installed args-0.1.0 certifi-2019.9.11 chardet-3.0.4 clint-0.5.1 id
136
154
 
137
155
  ### Development build
138
156
 
157
+ Dependency management, build and test is managed using Python Poetry.
158
+
159
+ To install Poetry, please refer to [the official Python Poetry website](https://python-poetry.org/).
160
+
139
161
  To install the current development version from GIT:
140
162
 
141
163
  ```bash
@@ -148,30 +170,34 @@ remote: Total 374 (delta 229), reused 299 (delta 175)
148
170
  Receiving objects: 100% (374/374), 62.84 KiB | 0 bytes/s, done.
149
171
  Resolving deltas: 100% (229/229), done.
150
172
 
151
- yk@lunar:~/dev$ pip3 install midpoint-cli/
152
- Processing ./midpoint-cli
153
- Collecting clint (from midpoint-cli===0.8-snapshot)
154
- Collecting requests (from midpoint-cli===0.8-snapshot)
155
- Using cached https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl
156
- Collecting tabulate (from midpoint-cli===0.8-snapshot)
157
- Collecting args (from clint->midpoint-cli===0.8-snapshot)
158
- Collecting chardet<3.1.0,>=3.0.2 (from requests->midpoint-cli===0.8-snapshot)
159
- Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
160
- Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests->midpoint-cli===0.8-snapshot)
161
- Using cached https://files.pythonhosted.org/packages/e0/da/55f51ea951e1b7c63a579c09dd7db825bb730ec1fe9c0180fc77bfb31448/urllib3-1.25.6-py2.py3-none-any.whl
162
- Collecting certifi>=2017.4.17 (from requests->midpoint-cli===0.8-snapshot)
163
- Using cached https://files.pythonhosted.org/packages/18/b0/8146a4f8dd402f60744fa380bc73ca47303cccf8b9190fd16a827281eac2/certifi-2019.9.11-py2.py3-none-any.whl
164
- Collecting idna<2.9,>=2.5 (from requests->midpoint-cli===0.8-snapshot)
165
- Using cached https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl
166
- Building wheels for collected packages: midpoint-cli
167
- Running setup.py bdist_wheel for midpoint-cli ... done
168
- Stored in directory: /home/yk/.cache/pip/wheels/2a/5a/d6/54312f2db19e2a44cea90e4e1c186e7c1beb7192b4974db759
169
- Successfully built midpoint-cli
170
- Installing collected packages: args, clint, chardet, urllib3, certifi, idna, requests, tabulate, midpoint-cli
171
- 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
173
+ yk@lunar:~/dev$ poetry install
174
+ Creating virtualenv midpoint-cli-54EjqR0S-py3.12 in /home/yk/.cache/pypoetry/virtualenvs
175
+ Updating dependencies
176
+ Resolving dependencies... (5.1s)
177
+
178
+ Package operations: 13 installs, 0 updates, 0 removals
179
+
180
+ - Installing args (0.1.0)
181
+ - Installing certifi (2024.8.30)
182
+ - Installing charset-normalizer (3.3.2)
183
+ - Installing idna (3.10)
184
+ - Installing iniconfig (2.0.0)
185
+ - Installing packaging (24.1)
186
+ - Installing pluggy (1.5.0)
187
+ - Installing urllib3 (2.2.3)
188
+ - Installing clint (0.5.1)
189
+ - Installing pytest (8.3.3)
190
+ - Installing requests (2.32.3)
191
+ - Installing tabulate (0.9.0)
192
+ - Installing unidecode (1.3.8)
193
+
194
+ Writing lock file
195
+
196
+ Installing the current project: midpoint-cli (1.4.0.dev2)
197
+
198
+ yk@lunar:~/dev$ poetry run midpoint-cli --version
199
+ Midpoint CLI Version 1.4.0.dev2
172
200
 
173
- yk@lunar:~/dev$ midpoint-cli -v
174
- Midpoint CLI Version 0.8-snapshot
175
201
  ```
176
202
 
177
203
  ### Anaconda
@@ -224,5 +250,6 @@ midpoint-1
224
250
  * Update revision in src/midpoint_cli/__init__.py
225
251
  * Commit and tag with corresponding version number
226
252
  * Generate markdown documentation: downdoc README.adoc
227
- * Build distribution: python setup.py sdist
228
- * Upload distribution to PyPI: twine upload dist/*
253
+ * Build distribution: poetry build
254
+ * Upload distribution to PyPI: poetry publish
255
+
@@ -1,3 +1,5 @@
1
+ ![link=https://badge.fury.io/py/midpoint-cli](https://badge.fury.io/py/midpoint-cli.svg)
2
+
1
3
  ## Midpoint CLI
2
4
 
3
5
  This project is a command line client interface used to drive an Evolveum Midpoint identity management server.
@@ -18,9 +20,9 @@ The client currently supports:
18
20
 
19
21
  Features currently under development:
20
22
 
21
- * Auto completion to search of IDs or task names
23
+ * Auto-completion to search of IDs or task names
22
24
  * Improved task results display: retrieve and display a human readable status output
23
- * 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
24
26
 
25
27
  The strong points of this project are:
26
28
 
@@ -119,6 +121,10 @@ Successfully installed args-0.1.0 certifi-2019.9.11 chardet-3.0.4 clint-0.5.1 id
119
121
 
120
122
  ### Development build
121
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
+
122
128
  To install the current development version from GIT:
123
129
 
124
130
  ```bash
@@ -131,30 +137,34 @@ remote: Total 374 (delta 229), reused 299 (delta 175)
131
137
  Receiving objects: 100% (374/374), 62.84 KiB | 0 bytes/s, done.
132
138
  Resolving deltas: 100% (229/229), done.
133
139
 
134
- yk@lunar:~/dev$ pip3 install midpoint-cli/
135
- Processing ./midpoint-cli
136
- Collecting clint (from midpoint-cli===0.8-snapshot)
137
- Collecting requests (from midpoint-cli===0.8-snapshot)
138
- Using cached https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl
139
- Collecting tabulate (from midpoint-cli===0.8-snapshot)
140
- Collecting args (from clint->midpoint-cli===0.8-snapshot)
141
- Collecting chardet<3.1.0,>=3.0.2 (from requests->midpoint-cli===0.8-snapshot)
142
- Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
143
- Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests->midpoint-cli===0.8-snapshot)
144
- Using cached https://files.pythonhosted.org/packages/e0/da/55f51ea951e1b7c63a579c09dd7db825bb730ec1fe9c0180fc77bfb31448/urllib3-1.25.6-py2.py3-none-any.whl
145
- Collecting certifi>=2017.4.17 (from requests->midpoint-cli===0.8-snapshot)
146
- Using cached https://files.pythonhosted.org/packages/18/b0/8146a4f8dd402f60744fa380bc73ca47303cccf8b9190fd16a827281eac2/certifi-2019.9.11-py2.py3-none-any.whl
147
- Collecting idna<2.9,>=2.5 (from requests->midpoint-cli===0.8-snapshot)
148
- Using cached https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl
149
- Building wheels for collected packages: midpoint-cli
150
- Running setup.py bdist_wheel for midpoint-cli ... done
151
- Stored in directory: /home/yk/.cache/pip/wheels/2a/5a/d6/54312f2db19e2a44cea90e4e1c186e7c1beb7192b4974db759
152
- Successfully built midpoint-cli
153
- Installing collected packages: args, clint, chardet, urllib3, certifi, idna, requests, tabulate, midpoint-cli
154
- 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
155
167
 
156
- yk@lunar:~/dev$ midpoint-cli -v
157
- Midpoint CLI Version 0.8-snapshot
158
168
  ```
159
169
 
160
170
  ### Anaconda
@@ -207,5 +217,5 @@ midpoint-1
207
217
  * Update revision in src/midpoint_cli/__init__.py
208
218
  * Commit and tag with corresponding version number
209
219
  * Generate markdown documentation: downdoc README.adoc
210
- * Build distribution: python setup.py sdist
211
- * Upload distribution to PyPI: twine upload dist/*
220
+ * Build distribution: poetry build
221
+ * Upload distribution to PyPI: poetry publish
@@ -0,0 +1,143 @@
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"
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
+ "Programming Language :: Python :: 3.14"
33
+ ]
34
+
35
+ [tool.poetry.scripts]
36
+ midpoint-cli = 'midpoint_cli:main'
37
+
38
+ [tool.poetry.dependencies]
39
+ python = "^3.9.0"
40
+ tabulate = "^0.9"
41
+ unidecode = "^1.3"
42
+ requests = "^2.31"
43
+ urllib3 = "^2.0"
44
+ rich = "^13.0"
45
+ prompt-toolkit = "^3.0"
46
+ pygments = "^2.0"
47
+
48
+ [tool.poetry.group.test.dependencies]
49
+ pytest = "*"
50
+
51
+ [tool.poetry.group.dev.dependencies]
52
+ pytest-cov = "*"
53
+ ruff = "*"
54
+ mypy = "*"
55
+
56
+ [tool.ruff]
57
+ target-version = "py39"
58
+ line-length = 120
59
+ exclude = [
60
+ ".git",
61
+ ".pytest_cache",
62
+ ".ruff_cache",
63
+ "__pycache__",
64
+ "build",
65
+ "dist",
66
+ "venv",
67
+ ".venv",
68
+ ]
69
+
70
+ [tool.ruff.lint]
71
+ select = [
72
+ "E", # pycodestyle errors
73
+ "W", # pycodestyle warnings
74
+ "F", # pyflakes
75
+ "I", # isort
76
+ "B", # flake8-bugbear
77
+ "C4", # flake8-comprehensions
78
+ "UP", # pyupgrade
79
+ ]
80
+ ignore = [
81
+ "E501", # line too long (handled by formatter)
82
+ ]
83
+
84
+ [tool.ruff.format]
85
+ quote-style = "single"
86
+ indent-style = "space"
87
+ skip-magic-trailing-comma = false
88
+ line-ending = "auto"
89
+
90
+ [tool.mypy]
91
+ python_version = "3.9"
92
+ warn_return_any = true
93
+ warn_unused_configs = true
94
+ disallow_untyped_defs = false
95
+ disallow_incomplete_defs = false
96
+ check_untyped_defs = true
97
+ disallow_untyped_decorators = false
98
+ warn_redundant_casts = true
99
+ warn_unused_ignores = true
100
+ warn_no_return = true
101
+ warn_unreachable = true
102
+ strict_equality = true
103
+ show_error_codes = true
104
+
105
+ [[tool.mypy.overrides]]
106
+ module = [
107
+ "tabulate.*",
108
+ "unidecode.*",
109
+ "requests.*",
110
+ "urllib3.*",
111
+ ]
112
+ ignore_missing_imports = true
113
+
114
+ [tool.coverage.run]
115
+ source = ["src"]
116
+ branch = true
117
+ omit = [
118
+ "*/tests/*",
119
+ "*/test/*",
120
+ "*/__pycache__/*",
121
+ "*/venv/*",
122
+ "*/.venv/*",
123
+ ]
124
+
125
+ [tool.coverage.report]
126
+ exclude_lines = [
127
+ "pragma: no cover",
128
+ "def __repr__",
129
+ "if self.debug:",
130
+ "if settings.DEBUG",
131
+ "raise AssertionError",
132
+ "raise NotImplementedError",
133
+ "if 0:",
134
+ "if __name__ == .__main__.:",
135
+ "class .*\\bProtocol\\):",
136
+ "@(abc\\.)?abstractmethod",
137
+ ]
138
+ show_missing = true
139
+ skip_covered = false
140
+ precision = 2
141
+
142
+ [tool.coverage.html]
143
+ 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()