midpoint-cli 1.3.0__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 (46) hide show
  1. {midpoint-cli-1.3.0 → midpoint_cli-1.4.0.dev6}/PKG-INFO +57 -33
  2. {midpoint-cli-1.3.0 → midpoint_cli-1.4.0.dev6}/README.md +37 -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.0 → 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.0 → midpoint_cli-1.4.0.dev6}/src/midpoint_cli/client/session.py +8 -11
  11. {midpoint-cli-1.3.0 → 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.0 → midpoint_cli-1.4.0.dev6}/src/midpoint_cli/prompt/complete.py +5 -7
  14. {midpoint-cli-1.3.0 → 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.0 → midpoint_cli-1.4.0.dev6}/src/midpoint_cli/prompt/delete.py +2 -4
  17. {midpoint-cli-1.3.0 → midpoint_cli-1.4.0.dev6}/src/midpoint_cli/prompt/get.py +9 -6
  18. {midpoint-cli-1.3.0 → midpoint_cli-1.4.0.dev6}/src/midpoint_cli/prompt/org.py +3 -4
  19. {midpoint-cli-1.3.0 → midpoint_cli-1.4.0.dev6}/src/midpoint_cli/prompt/put.py +6 -8
  20. {midpoint-cli-1.3.0 → midpoint_cli-1.4.0.dev6}/src/midpoint_cli/prompt/resource.py +7 -5
  21. {midpoint-cli-1.3.0 → midpoint_cli-1.4.0.dev6}/src/midpoint_cli/prompt/script.py +7 -11
  22. {midpoint-cli-1.3.0 → midpoint_cli-1.4.0.dev6}/src/midpoint_cli/prompt/task.py +23 -10
  23. {midpoint-cli-1.3.0 → midpoint_cli-1.4.0.dev6}/src/midpoint_cli/prompt/user.py +5 -4
  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/base.py +0 -5
  38. midpoint-cli-1.3.0/src/midpoint_cli/prompt/console.py +0 -21
  39. midpoint-cli-1.3.0/test/test_client_api.py +0 -43
  40. midpoint-cli-1.3.0/test/test_client_model.py +0 -39
  41. midpoint-cli-1.3.0/test/test_client_put.py +0 -44
  42. midpoint-cli-1.3.0/test/test_environment.py +0 -54
  43. midpoint-cli-1.3.0/test/test_parser.py +0 -62
  44. midpoint-cli-1.3.0/test/test_patch.py +0 -30
  45. midpoint-cli-1.3.0/test/test_script.py +0 -49
  46. {midpoint-cli-1.3.0 → midpoint_cli-1.4.0.dev6}/LICENSE +0 -0
@@ -1,19 +1,34 @@
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.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
30
+
31
+ ![link=https://badge.fury.io/py/midpoint-cli](https://badge.fury.io/py/midpoint-cli.svg)
17
32
 
18
33
  ## Midpoint CLI
19
34
 
@@ -35,9 +50,9 @@ The client currently supports:
35
50
 
36
51
  Features currently under development:
37
52
 
38
- * Auto completion to search of IDs or task names
53
+ * Auto-completion to search of IDs or task names
39
54
  * 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
55
+ * Any other tasks that would be submitted in the issue tracker of this project on Gitlab
41
56
 
42
57
  The strong points of this project are:
43
58
 
@@ -136,6 +151,10 @@ Successfully installed args-0.1.0 certifi-2019.9.11 chardet-3.0.4 clint-0.5.1 id
136
151
 
137
152
  ### Development build
138
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
+
139
158
  To install the current development version from GIT:
140
159
 
141
160
  ```bash
@@ -148,30 +167,34 @@ remote: Total 374 (delta 229), reused 299 (delta 175)
148
167
  Receiving objects: 100% (374/374), 62.84 KiB | 0 bytes/s, done.
149
168
  Resolving deltas: 100% (229/229), done.
150
169
 
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
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
172
197
 
173
- yk@lunar:~/dev$ midpoint-cli -v
174
- Midpoint CLI Version 0.8-snapshot
175
198
  ```
176
199
 
177
200
  ### Anaconda
@@ -224,5 +247,6 @@ midpoint-1
224
247
  * Update revision in src/midpoint_cli/__init__.py
225
248
  * Commit and tag with corresponding version number
226
249
  * Generate markdown documentation: downdoc README.adoc
227
- * Build distribution: python setup.py sdist
228
- * Upload distribution to PyPI: twine upload dist/*
250
+ * Build distribution: poetry build
251
+ * Upload distribution to PyPI: poetry publish
252
+
@@ -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,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()