Merge branch '19785-add-cwl' into main
[lightning.git] / cwl / lightning / batch-dirs.cwl
1 # Copyright (C) The Lightning Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 cwlVersion: v1.2
6 class: ExpressionTool
7 requirements:
8   InlineJavascriptRequirement: {}
9 inputs:
10   dirs:
11     type:
12       type: array
13       items: Directory
14   batchsize:
15     type: int
16 outputs:
17   batches:
18     type:
19       type: array
20       items:
21         type: array
22         items: Directory
23 expression: |
24   ${
25     var batches = [];
26     for (var i = 0; i < inputs.dirs.length; i+=inputs.batchsize) {
27       var batch = inputs.dirs.slice(i, i+inputs.batchsize);
28       batches.push(batch);
29     }
30     return {"batches": batches};
31   }