diff options
author | Arun Isaac | 2021-06-29 11:04:54 +0530 |
---|---|---|
committer | Arun Isaac | 2021-06-29 11:07:42 +0530 |
commit | 68327fda24b852ec4daed02ad677c49da75c38aa (patch) | |
tree | c7d4eedf8539df8d57031fc1473baba38c480bd6 /doc | |
parent | 5ba0ef3dc28c17a8873d5588b4ce8552a88abe8b (diff) | |
download | ccwl-68327fda24b852ec4daed02ad677c49da75c38aa.tar.gz ccwl-68327fda24b852ec4daed02ad677c49da75c38aa.tar.lz ccwl-68327fda24b852ec4daed02ad677c49da75c38aa.zip |
doc: Document passing input into stdin.
* doc/ccwl.skb (Tutorial)[Passing input into the standard input stream
of a command]: New section.
* doc/pass-stdin.scm, doc/pass-stdin.out: New files.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/ccwl.skb | 15 | ||||
-rw-r--r-- | doc/pass-stdin.out | 13 | ||||
-rw-r--r-- | doc/pass-stdin.scm | 7 |
3 files changed, 35 insertions, 0 deletions
diff --git a/doc/ccwl.skb b/doc/ccwl.skb index 51ce5bf..2fec996 100644 --- a/doc/ccwl.skb +++ b/doc/ccwl.skb @@ -149,6 +149,21 @@ output.]) (prog :line #f (source :file "doc/capture-output-file-with-parameter-reference.out"))) + (section :title [Passing input into the standard input stream of a command] + (p [Some commands read input from their standard input +stream. Let us do that from ccwl. The workflow below reports the size +of a file by passing it into the standard input of +,(command "wc"). Notice the additional ,(code "#:stdin") keyword that +references the input ,(code "file").]) + + (scheme-source "doc/pass-stdin.scm") + + (p [Compiling and running this workflow gives us the following +output. Notice the file ,(file "foo") passed into the standard input +of ,(command "wc"), and the file size reported in bytes.]) + + (prog :line #f (source :file "doc/pass-stdin.out"))) + (section :title [Workflow with multiple steps] (p [Till now, we have only written trivial workflows with a single command. If we were only interested in executing single diff --git a/doc/pass-stdin.out b/doc/pass-stdin.out new file mode 100644 index 0000000..c4af7da --- /dev/null +++ b/doc/pass-stdin.out @@ -0,0 +1,13 @@ +$ ccwl compile pass-stdin.scm > pass-stdin.cwl +$ cwltool pass-stdin.cwl --file foo + [workflow ] start + [workflow ] starting step count-bytes + [step count-bytes] start + [job count-bytes] /tmp/wxi6_9jz$ wc \ + -c < /tmp/siden6hu/stg51eaae41-52a5-4e69-a78e-caefd84f7af5/foo +37 + [job count-bytes] completed success + [step count-bytes] completed success + [workflow ] completed success +{} + Final process status is success
\ No newline at end of file diff --git a/doc/pass-stdin.scm b/doc/pass-stdin.scm new file mode 100644 index 0000000..3bdc70b --- /dev/null +++ b/doc/pass-stdin.scm @@ -0,0 +1,7 @@ +(define count-bytes + (command #:inputs (file #:type 'File) + #:run "wc" "-c" + #:stdin file)) + +(workflow ((file #:type File)) + (count-bytes #:file file)) |