1
1
# Creating Files at Runtime
2
2
3
3
Sometimes you need to create a file on the fly from input parameters,
4
- such as tools which expect to read their input configuration from a file
4
+ such as tools that expect to read their input configuration from a file
5
5
rather than the command line parameters, or need a small wrapper shell script.
6
6
7
- To generate such files we can use the ` InitialWorkDirRequirement ` .
7
+ To generate such files, we can use the ` InitialWorkDirRequirement ` .
8
8
9
9
``` {literalinclude} /_includes/cwl/creating-files-at-runtime/createfile.cwl
10
10
:language: cwl
@@ -13,32 +13,32 @@ To generate such files we can use the `InitialWorkDirRequirement`.
13
13
```
14
14
15
15
Any [ expressions] ( ../topics/expressions.md ) like ` $(inputs.message) ` are
16
- expanded by the CWL engine before creating the file;
17
- here inserting the value at the input ` message ` .
16
+ expanded by the CWL engine before creating the file.
17
+ Here, insert the value at the input ` message ` .
18
18
19
19
``` {tip}
20
20
The _CWL expressions_ are independent of any _shell variables_
21
21
used later during command line tool invocation. That means that any genuine
22
- need for the character `$` must be **escaped** with `\`,
23
- for instance `\${PREFIX}` above is expanded to `${PREFIX}` in the generated file
22
+ need for the character `$` must be **escaped** with `\`.
23
+ For instance, `\${PREFIX}` above is expanded to `${PREFIX}` in the generated file
24
24
to be evaluated by the shell script instead of the CWL engine.
25
25
```
26
26
27
- To test the above CWL tool use this job to provide the input value ` message ` :
27
+ To test the above CWL tool, use this job to provide the input value ` message ` :
28
28
29
29
``` {literalinclude} /_includes/cwl/creating-files-at-runtime/echo-job.yml
30
30
:language: yaml
31
31
:caption: "`echo-job.yml`"
32
32
:name: echo-job.yml
33
33
```
34
34
35
- Before we run this, lets look at each step in a little more detail.
35
+ Before we run this, let us look at each step in a little more detail.
36
36
The base command ` baseCommand: ["sh", "example.sh"] `
37
37
will execute the command ` sh example.sh ` .
38
38
This will run the file we create in the shell.
39
39
40
40
` InitialWorkDirRequirement ` requires a ` listing ` .
41
- As the ` listing ` is a YAML array we need a ` - ` on the first line of
41
+ As the ` listing ` is a YAML array, we need a ` - ` on the first line of
42
42
each element of the array, in this case we have just one element.
43
43
` entryname: ` can have any value,
44
44
but it must match what was specified in the ` baseCommand ` .
0 commit comments