Repository: valohai/valohai-cli

Issue:
Support multiple files per input
Support for this seems to be lacking in the CLI, even if the web UI and API support it.

Discussion:
codecov[bot]: # [Codecov](https://codecov.io/gh/valohai/valohai-cli/pull/52?src=pr&el=h1) Report
> Merging [#52](https://codecov.io/gh/valohai/valohai-cli/pull/52?src=pr&el=desc) into [master](https://codecov.io/gh/valohai/valohai-cli/commit/d78841c98ea4016a2c79bf899b44e86920535a21?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/valohai/valohai-cli/pull/52/graphs/tree.svg?width=650&token=xqgKRx94XH&height=150&src=pr)](https://codecov.io/gh/valohai/valohai-cli/pull/52?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master      #52   +/-   ##
=======================================
  Coverage   88.62%   88.62%           
=======================================
  Files          82       82           
  Lines        2154     2154           
  Branches      277      277           
=======================================
  Hits         1909     1909           
  Misses        151      151           
  Partials       94       94
```


| [Impacted Files](https://codecov.io/gh/valohai/valohai-cli/pull/52?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [valohai\_cli/commands/execution/run.py](https://codecov.io/gh/valohai/valohai-cli/pull/52/diff?src=pr&el=tree#diff-dmFsb2hhaV9jbGkvY29tbWFuZHMvZXhlY3V0aW9uL3J1bi5weQ==) | `75.75% <ø> (ø)` | :arrow_up: |
| [tests/commands/execution/test\_run.py](https://codecov.io/gh/valohai/valohai-cli/pull/52/diff?src=pr&el=tree#diff-dGVzdHMvY29tbWFuZHMvZXhlY3V0aW9uL3Rlc3RfcnVuLnB5) | `100% <100%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/valohai/valohai-cli/pull/52?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/valohai/valohai-cli/pull/52?src=pr&el=footer). Last update [d78841c...d1ba22b](https://codecov.io/gh/valohai/valohai-cli/pull/52?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/valohai_cli/commands/execution/run.py b/valohai_cli/commands/execution/run.py
index 643cc5c..9b85f99 100644
--- a/valohai_cli/commands/execution/run.py
+++ b/valohai_cli/commands/execution/run.py
@@ -71,6 +71,7 @@ class RunCommand(click.Command):
         super(RunCommand, self).__init__(
             name=sanitize_name(step.name.lower()),
             callback=self.execute,
+            epilog='Multiple files per input: --my-input=myurl --my-input=myotherurl',
             add_help_option=True,
         )
         for parameter in step.parameters.values():
@@ -107,8 +108,9 @@ class RunCommand(click.Command):
         option = click.Option(
             param_decls=list(generate_sanitized_options(input.name)),
             required=(input.default is None and not input.optional),
-            default=input.default,
+            default=([input.default] if input.default else []),
             metavar='URL',
+            multiple=True,
             help='Input "%s"' % humanize_identifier(input.name),
         )
         option.name = '^%s' % input.name  # Caretize so we can pick these out of kwargs easily


Test patch:
diff --git a/tests/commands/execution/test_run.py b/tests/commands/execution/test_run.py
index fc78001..7e42a90 100644
--- a/tests/commands/execution/test_run.py
+++ b/tests/commands/execution/test_run.py
@@ -83,7 +83,8 @@ def test_run(runner, logged_in_and_linked, monkeypatch, pass_param, pass_input,
 
     if pass_input:
         args.append('--in1=http://url')
-        values['inputs'] = {'in1': 'http://url'}
+        args.append('--in1=http://anotherurl')
+        values['inputs'] = {'in1': ['http://url', 'http://anotherurl']}
 
     if pass_env:
         args.append('--environment=015dbd56-2670-b03e-f37c-dc342714f1b5')