cli2 2.7.1__tar.gz → 2.7.2__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-2.7.1/cli2.egg-info → cli2-2.7.2}/PKG-INFO +1 -1
- {cli2-2.7.1 → cli2-2.7.2}/cli2/command.py +12 -13
- {cli2-2.7.1 → cli2-2.7.2}/cli2/test_command.py +3 -5
- {cli2-2.7.1 → cli2-2.7.2/cli2.egg-info}/PKG-INFO +1 -1
- {cli2-2.7.1 → cli2-2.7.2}/setup.py +1 -1
- {cli2-2.7.1 → cli2-2.7.2}/MANIFEST.in +0 -0
- {cli2-2.7.1 → cli2-2.7.2}/README.rst +0 -0
- {cli2-2.7.1 → cli2-2.7.2}/classifiers.txt +0 -0
- {cli2-2.7.1 → cli2-2.7.2}/cli2/__init__.py +0 -0
- {cli2-2.7.1 → cli2-2.7.2}/cli2/argument.py +0 -0
- {cli2-2.7.1 → cli2-2.7.2}/cli2/cli.py +0 -0
- {cli2-2.7.1 → cli2-2.7.2}/cli2/colors.py +0 -0
- {cli2-2.7.1 → cli2-2.7.2}/cli2/decorators.py +0 -0
- {cli2-2.7.1 → cli2-2.7.2}/cli2/entry_point.py +0 -0
- {cli2-2.7.1 → cli2-2.7.2}/cli2/group.py +0 -0
- {cli2-2.7.1 → cli2-2.7.2}/cli2/node.py +0 -0
- {cli2-2.7.1 → cli2-2.7.2}/cli2/table.py +0 -0
- {cli2-2.7.1 → cli2-2.7.2}/cli2/test.py +0 -0
- {cli2-2.7.1 → cli2-2.7.2}/cli2/test_cli.py +0 -0
- {cli2-2.7.1 → cli2-2.7.2}/cli2/test_decorators.py +0 -0
- {cli2-2.7.1 → cli2-2.7.2}/cli2/test_entrypoint.py +0 -0
- {cli2-2.7.1 → cli2-2.7.2}/cli2/test_group.py +0 -0
- {cli2-2.7.1 → cli2-2.7.2}/cli2/test_inject.py +0 -0
- {cli2-2.7.1 → cli2-2.7.2}/cli2/test_node.py +0 -0
- {cli2-2.7.1 → cli2-2.7.2}/cli2/test_table.py +0 -0
- {cli2-2.7.1 → cli2-2.7.2}/cli2.egg-info/SOURCES.txt +0 -0
- {cli2-2.7.1 → cli2-2.7.2}/cli2.egg-info/dependency_links.txt +0 -0
- {cli2-2.7.1 → cli2-2.7.2}/cli2.egg-info/entry_points.txt +0 -0
- {cli2-2.7.1 → cli2-2.7.2}/cli2.egg-info/requires.txt +0 -0
- {cli2-2.7.1 → cli2-2.7.2}/cli2.egg-info/top_level.txt +0 -0
- {cli2-2.7.1 → cli2-2.7.2}/setup.cfg +0 -0
|
@@ -164,21 +164,18 @@ class Command(EntryPoint, dict):
|
|
|
164
164
|
self.exit_code = 1
|
|
165
165
|
return self.help(error=error)
|
|
166
166
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
for arg in self.
|
|
170
|
-
if
|
|
171
|
-
and
|
|
172
|
-
and arg.param.
|
|
173
|
-
|
|
174
|
-
arg.param.
|
|
167
|
+
missing = [
|
|
168
|
+
name
|
|
169
|
+
for name, arg in self.items()
|
|
170
|
+
if name not in self.bound.arguments
|
|
171
|
+
and name not in self.bound.kwargs
|
|
172
|
+
and arg.param.default == arg.param.empty
|
|
173
|
+
and arg.param.kind in (
|
|
174
|
+
arg.param.POSITIONAL_ONLY,
|
|
175
|
+
arg.param.POSITIONAL_OR_KEYWORD,
|
|
175
176
|
)
|
|
176
177
|
]
|
|
177
|
-
if
|
|
178
|
-
missing = [
|
|
179
|
-
arg.param.name
|
|
180
|
-
for arg in required[len(self.bound.args):]
|
|
181
|
-
]
|
|
178
|
+
if missing:
|
|
182
179
|
error = (
|
|
183
180
|
f'missing {len(missing)} required argument'
|
|
184
181
|
f'{"s" if len(missing) > 1 else ""}'
|
|
@@ -192,6 +189,8 @@ class Command(EntryPoint, dict):
|
|
|
192
189
|
if inspect.iscoroutine(result):
|
|
193
190
|
result = asyncio.run(result)
|
|
194
191
|
except TypeError as exc:
|
|
192
|
+
# keeping this as fallback for now, in case the above missing
|
|
193
|
+
# detection doesn't work
|
|
195
194
|
self.exit_code = 1
|
|
196
195
|
if hasattr(self.target, '__name__'):
|
|
197
196
|
rep = getattr(self.target, '__name__')
|
|
@@ -499,13 +499,11 @@ def test_arg_reorder():
|
|
|
499
499
|
|
|
500
500
|
|
|
501
501
|
def test_arg():
|
|
502
|
-
|
|
503
|
-
def call(self, *args, **kwargs):
|
|
504
|
-
return (args, kwargs)
|
|
505
|
-
|
|
506
|
-
cmd = TestCommand(lambda foo: True)
|
|
502
|
+
cmd = Command(lambda foo: foo)
|
|
507
503
|
cmd.arg('bar', position=0)
|
|
508
504
|
assert list(cmd.keys()) == ['bar', 'foo']
|
|
505
|
+
assert cmd('bar', 'foo') == 'foo'
|
|
506
|
+
assert cmd['bar'].value == 'bar'
|
|
509
507
|
|
|
510
508
|
|
|
511
509
|
def test_helphack():
|
|
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
|