cli2 3.3.4__tar.gz → 3.3.6__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.
- {cli2-3.3.4/cli2.egg-info → cli2-3.3.6}/PKG-INFO +1 -1
- {cli2-3.3.4 → cli2-3.3.6}/cli2/configuration.py +8 -1
- {cli2-3.3.4 → cli2-3.3.6}/cli2/test_configuration.py +7 -0
- {cli2-3.3.4 → cli2-3.3.6/cli2.egg-info}/PKG-INFO +1 -1
- {cli2-3.3.4 → cli2-3.3.6}/setup.py +1 -1
- {cli2-3.3.4 → cli2-3.3.6}/MANIFEST.in +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/README.rst +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/classifiers.txt +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/__init__.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/argument.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/asyncio.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/cli.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/client.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/colors.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/command.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/decorators.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/display.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/entry_point.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/example_client.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/example_client_complex.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/example_nesting.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/example_obj.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/group.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/logging.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/node.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/overrides.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/sphinx.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/table.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/test.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/test_cli.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/test_client.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/test_command.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/test_decorators.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/test_display.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/test_entry_point.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/test_group.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/test_inject.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/test_node.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2/test_table.py +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2.egg-info/SOURCES.txt +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2.egg-info/dependency_links.txt +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2.egg-info/entry_points.txt +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2.egg-info/requires.txt +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/cli2.egg-info/top_level.txt +0 -0
- {cli2-3.3.4 → cli2-3.3.6}/setup.cfg +0 -0
|
@@ -85,7 +85,7 @@ class Configuration(dict):
|
|
|
85
85
|
value = input(prompt + '\n> ')
|
|
86
86
|
confirm = None
|
|
87
87
|
while confirm not in ('', 'y', 'Y', 'n'):
|
|
88
|
-
confirm = input(f'Confirm value of:\n{value}
|
|
88
|
+
confirm = input(f'Confirm value of:\n{value}\n(Y/n) >')
|
|
89
89
|
if confirm in ('', 'y', 'Y'):
|
|
90
90
|
# user is satisfied
|
|
91
91
|
return value
|
|
@@ -158,8 +158,15 @@ class Configuration(dict):
|
|
|
158
158
|
escaped_value = shlex.quote(value)
|
|
159
159
|
with self.profile_path.open('a') as f:
|
|
160
160
|
f.write(f'\nexport {key}={escaped_value}')
|
|
161
|
+
self.print(
|
|
162
|
+
f'Appended to {self.profile_path}:'
|
|
163
|
+
f'\nexport {key}={escaped_value}'
|
|
164
|
+
)
|
|
161
165
|
return value
|
|
162
166
|
|
|
167
|
+
def print(self, *args, **kwargs):
|
|
168
|
+
print(*args, **kwargs)
|
|
169
|
+
|
|
163
170
|
def delete(self, key, reason=None):
|
|
164
171
|
"""
|
|
165
172
|
Delete a variable from everywhere, useful if an api key expired.
|
|
@@ -7,10 +7,14 @@ class Configuration(cli2.Configuration):
|
|
|
7
7
|
def __init__(self, *args, **kwargs):
|
|
8
8
|
super().__init__(*args, **kwargs)
|
|
9
9
|
self.expected_prompts = dict()
|
|
10
|
+
self.prints = []
|
|
10
11
|
|
|
11
12
|
def input(self, prompt):
|
|
12
13
|
return self.expected_prompts.pop(prompt)
|
|
13
14
|
|
|
15
|
+
def print(self, *args, **kwargs):
|
|
16
|
+
self.prints.append((args, kwargs))
|
|
17
|
+
|
|
14
18
|
|
|
15
19
|
def test_idempotent(tmp_path):
|
|
16
20
|
profile_path = tmp_path / 'bashrc'
|
|
@@ -68,3 +72,6 @@ def test_idempotent(tmp_path):
|
|
|
68
72
|
'''
|
|
69
73
|
cfg.expected_prompts['Test\nFor\nDedent'] = 'success'
|
|
70
74
|
assert cfg['TEST'] == 'success'
|
|
75
|
+
assert cfg.prints[0][0][0] == (
|
|
76
|
+
f'Appended to {cfg.profile_path}:\nexport TEST=success'
|
|
77
|
+
)
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|