cli2 4.0.12__tar.gz → 4.0.13__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-4.0.12/cli2.egg-info → cli2-4.0.13}/PKG-INFO +1 -1
- {cli2-4.0.12 → cli2-4.0.13}/cli2/cli.py +6 -0
- {cli2-4.0.12 → cli2-4.0.13/cli2.egg-info}/PKG-INFO +1 -1
- {cli2-4.0.12 → cli2-4.0.13}/setup.py +1 -1
- {cli2-4.0.12 → cli2-4.0.13}/tests/test_command.py +12 -0
- {cli2-4.0.12 → cli2-4.0.13}/MANIFEST.in +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/README.rst +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/classifiers.txt +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/__init__.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/ansible/__init__.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/ansible/action.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/ansible/playbook.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/ansible/pytest.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/ansible/variables.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/asyncio.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/cli2.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/client.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/colors.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/configuration.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/decorators.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/display.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/examples/__init__.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/examples/client.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/examples/conf.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/examples/example.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/examples/example_obj.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/examples/nesting.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/examples/obj.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/examples/obj2.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/examples/test.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/lock.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/log.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/node.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/sphinx.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/table.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2/test.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2.egg-info/SOURCES.txt +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2.egg-info/dependency_links.txt +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2.egg-info/entry_points.txt +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2.egg-info/requires.txt +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/cli2.egg-info/top_level.txt +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/setup.cfg +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/tests/test_ansible.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/tests/test_ansible_variables.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/tests/test_asyncio.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/tests/test_cli.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/tests/test_client.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/tests/test_configuration.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/tests/test_decorators.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/tests/test_display.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/tests/test_entry_point.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/tests/test_group.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/tests/test_inject.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/tests/test_lock.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/tests/test_node.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/tests/test_restful.py +0 -0
- {cli2-4.0.12 → cli2-4.0.13}/tests/test_table.py +0 -0
|
@@ -1161,6 +1161,9 @@ class Argument:
|
|
|
1161
1161
|
command object.
|
|
1162
1162
|
|
|
1163
1163
|
If the factory function takes an `arg` argument, it will pass self.
|
|
1164
|
+
|
|
1165
|
+
It will forward any argument to the factory function if detected in
|
|
1166
|
+
it's signature.
|
|
1164
1167
|
"""
|
|
1165
1168
|
kwargs = dict()
|
|
1166
1169
|
sig = inspect.signature(self.factory)
|
|
@@ -1168,4 +1171,7 @@ class Argument:
|
|
|
1168
1171
|
kwargs['cmd'] = self.cmd
|
|
1169
1172
|
if 'arg' in sig.parameters:
|
|
1170
1173
|
kwargs['arg'] = self
|
|
1174
|
+
for key, arg in self.cmd.items():
|
|
1175
|
+
if key in sig.parameters:
|
|
1176
|
+
kwargs[key] = arg.value
|
|
1171
1177
|
return self.factory(**kwargs)
|
|
@@ -707,3 +707,15 @@ def test_keyboard_interrupt_async():
|
|
|
707
707
|
cmd()
|
|
708
708
|
assert cmd.exit_code == 1
|
|
709
709
|
assert cmd.post_result == 'foo'
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
def test_factory_value_args():
|
|
713
|
+
def myfactory(foo):
|
|
714
|
+
return foo
|
|
715
|
+
|
|
716
|
+
@cli2.arg('bar', factory=myfactory)
|
|
717
|
+
def mycmd(foo, bar):
|
|
718
|
+
return foo
|
|
719
|
+
|
|
720
|
+
cmd = cli2.Command(mycmd)
|
|
721
|
+
assert cmd('a') == 'a'
|
|
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
|
|
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
|