viash-io / viash

script + metadata = standalone component
https://viash.io
GNU General Public License v3.0
36 stars 2 forks source link

[BUG] file arguments with multiple true require a wildcard but still end up being lists #706

Open rcannood opened 1 month ago

rcannood commented 1 month ago

What happened?

When defining a file argument with multiple: true and direction: output, viash 0.8.6 expects any values passed to that argument to contain a wildcard. E.g.

functionality:
  name: test
  arguments:
    - type: file
      name: --output
      direction: output
      multiple: true
      must_exist: false
  resources:
    - type: python_script
      text: |
        print(par)
$ viash run config.vsh.yaml -- --output foo.txt

[error] --output has to be a path containing a wildcard, e.g. output_*.txt. Use --help to get more information on the parameters.

However, one would then perhaps expect that par["output"] would be a string containing that wildcard, not a list of a string.

$ viash run config.vsh.yaml -- --output foo*.txt
{'output': ['foo*.txt']}

Especially given that viash now does not allow passing multiple values:

$ viash run config.vsh.yaml -- --output foo*.txt --output bar*.txt
[error] Bad arguments for option '--output': 'foo*.txt' & 'bar*.txt' - you should provide exactly one argument for this option.
Files and logs are stored at '/tmp/viash_test12865580121557640188'

Thus, we need to change viash such that it passes par to the script as {"output": "foo*.txt"}.

Steps to reproduce

/

Expected behavior

/

Relevant log output

/

Version

Viash 0.8.6

Possible solution

No response

Confirmation

Additional context

No response