I often need support optional input as File or as array of File entries. For example, I want to create command line option like the following:
--opt A --opt B --opt C
I can define the following in cwl:
inputs:
opt:
type:
- "null"
- type: array
items: File
inputBinding:
prefix: --opt
However this won't support single element input if not as an array. I wish I could do the following:
inputs:
opt:
type:
- "null"
- type: array
items: File
inputBinding:
prefix: --opt
- type: File
inputBinding:
prefix: --opt
It will complain about the - type: File
as
* the `type` field is not valid because
the value 'File' is not a valid Record_symbol, expected
'record'
Any help would be appreciated.
I tried the hack to use
itemSeparator
. But the command line created has quote for items connected by itemSeparator, which causes error in option parsing in the binary. It is common in my application to mix usage of single input or multiple inputs like--opt input1 --opt input 2
. Is it a good idea to add another option for inputBinding to distinguish between '--opt input1 input2' and "--opt input1 --opt inptu2"? I feel that both are common enough.Then the second option I gave should work for you as it prefixed "--opt" prior to each item.
give "--opt file2 --opt file2"
while
gives "--opt file1 file2"