Hello!
I’m trying to concatenate the content of some small files using the ExpressionTool, but it seems that the loadContents doesn’t work on arrays, despite in the doc it includes arrays of files.
Here’s a small example to reproduce the error:
cwlVersion: v1.2
class: ExpressionTool
requirements:
InlineJavascriptRequirement: {}
inputs:
input_files:
type: File[]
loadContents: true
single_file:
type: File
loadContents: true
outputs:
output_file:
type: File
expression: |
${
var out = { output_file : { class : "File", basename : "test.txt" , contents : "" } }
for (var i = 0; i < inputs.input_files.length; i++) {
if ( inputs.input_files[i] ){
if ( inputs.input_files[i].contents.match(out.output_file.contents) ){
continue
}
out.output_file.contents += inputs.input_files[i].contents + "\n"
}
}
return out
}
test.yaml:
input_files:
- class: File
location: test1.txt
- class: File
location: test2.txt
single_file:
class: File
location: test3.txt