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.
- {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/PKG-INFO +60 -33
- {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/README.md +37 -27
- midpoint_cli-1.4.0/pyproject.toml +143 -0
- midpoint_cli-1.4.0/src/midpoint_cli/__init__.py +83 -0
- midpoint_cli-1.4.0/src/midpoint_cli/client/__init__.py +240 -0
- midpoint_cli-1.4.0/src/midpoint_cli/client/objects.py +364 -0
- midpoint_cli-1.4.0/src/midpoint_cli/client/observer.py +26 -0
- {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/src/midpoint_cli/client/patch.py +1 -1
- midpoint_cli-1.4.0/src/midpoint_cli/client/progress.py +33 -0
- {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/src/midpoint_cli/client/session.py +8 -11
- midpoint_cli-1.4.0/src/midpoint_cli/prompt/__init__.py +165 -0
- midpoint_cli-1.4.0/src/midpoint_cli/prompt/base.py +13 -0
- {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/src/midpoint_cli/prompt/complete.py +5 -7
- {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/src/midpoint_cli/prompt/configuration.py +4 -4
- midpoint_cli-1.4.0/src/midpoint_cli/prompt/console.py +297 -0
- {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/src/midpoint_cli/prompt/delete.py +2 -4
- {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/src/midpoint_cli/prompt/get.py +12 -8
- {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/src/midpoint_cli/prompt/org.py +35 -8
- {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/src/midpoint_cli/prompt/put.py +6 -8
- {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/src/midpoint_cli/prompt/resource.py +56 -11
- {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/src/midpoint_cli/prompt/script.py +7 -11
- {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/src/midpoint_cli/prompt/task.py +71 -20
- {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/src/midpoint_cli/prompt/user.py +42 -9
- midpoint-cli-1.3.0/midpoint_cli.egg-info/PKG-INFO +0 -228
- midpoint-cli-1.3.0/midpoint_cli.egg-info/SOURCES.txt +0 -37
- midpoint-cli-1.3.0/midpoint_cli.egg-info/dependency_links.txt +0 -1
- midpoint-cli-1.3.0/midpoint_cli.egg-info/requires.txt +0 -6
- midpoint-cli-1.3.0/midpoint_cli.egg-info/top_level.txt +0 -1
- midpoint-cli-1.3.0/setup.cfg +0 -7
- midpoint-cli-1.3.0/setup.py +0 -47
- midpoint-cli-1.3.0/src/midpoint-cli +0 -67
- midpoint-cli-1.3.0/src/midpoint_cli/__init__.py +0 -1
- midpoint-cli-1.3.0/src/midpoint_cli/client/__init__.py +0 -228
- midpoint-cli-1.3.0/src/midpoint_cli/client/objects.py +0 -215
- midpoint-cli-1.3.0/src/midpoint_cli/client/observer.py +0 -10
- midpoint-cli-1.3.0/src/midpoint_cli/client/progress.py +0 -26
- midpoint-cli-1.3.0/src/midpoint_cli/prompt/__init__.py +0 -63
- midpoint-cli-1.3.0/src/midpoint_cli/prompt/base.py +0 -5
- midpoint-cli-1.3.0/src/midpoint_cli/prompt/console.py +0 -21
- midpoint-cli-1.3.0/test/test_client_api.py +0 -43
- midpoint-cli-1.3.0/test/test_client_model.py +0 -39
- midpoint-cli-1.3.0/test/test_client_put.py +0 -44
- midpoint-cli-1.3.0/test/test_environment.py +0 -54
- midpoint-cli-1.3.0/test/test_parser.py +0 -62
- midpoint-cli-1.3.0/test/test_patch.py +0 -30
- midpoint-cli-1.3.0/test/test_script.py +0 -49
- {midpoint-cli-1.3.0 → midpoint_cli-1.4.0}/LICENSE +0 -0
@@ -1,19 +1,37 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: midpoint-cli
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.4.0
|
4
4
|
Summary: A command line client to Midpoint Identity Management system.
|
5
|
-
|
5
|
+
License: MIT
|
6
|
+
License-File: LICENSE
|
6
7
|
Author: Yannick Kirschhoffer
|
7
8
|
Author-email: alcibiade@alcibiade.org
|
8
|
-
|
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
|
-
|
33
|
+
|
34
|
+

|
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
|
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
|
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$
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
Installing
|
171
|
-
|
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:
|
228
|
-
* Upload distribution to PyPI:
|
253
|
+
* Build distribution: poetry build
|
254
|
+
* Upload distribution to PyPI: poetry publish
|
255
|
+
|
@@ -1,3 +1,5 @@
|
|
1
|
+

|
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
|
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
|
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$
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
Installing
|
154
|
-
|
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:
|
211
|
-
* Upload distribution to PyPI:
|
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()
|