common-workflow-language / common-workflow-language/user_guide

Add discussion about how command lines work; spaces in options

Open
#39 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
Common Workflow Language
Stars
42
Forks
65
PR merge metrics
No merged PRs in 30d

Description

Real world example:
https://github.com/gijzelaerr/spiel/blob/181b889c77a59a83f1939a2e2c08d8aea5e14469/steps/wsclean.cwl

The tool expects `-size 2048 2048` and the POSIX shell `sh` turns that into three entries in the argument array: `-size`, `2048`, and `2048`. However this description passes the sizes in as a single string which becomes only two entries `-size` and `2048 2048` which is rejected by the tool.

Ideally the tool would accept `2048 2048` (with the embedded space) or have split options for each element (like `-xsize` and `-ysize`)

Here's a workaround using `arguments` that doesn't require any code changes to the underlying tool

```
cwlVersion: v1.0
class: CommandLineTool

baseCommand: wsclean

hints:
DockerRequirement:
dockerImageId: kernsuite/wsclean
dockerFile: |
FROM kernsuite/base:3
RUN docker-apt-install wsclean

inputs:
ms:
type: Directory
inputBinding:
position: 1

xsize:
type: int
default: 2048

ysize:
type: int
default: 2048

scale:
type: string
default: 1asec
inputBinding:
prefix: -scale

arguments:
- -size
- $(inputs.xsize)
- $(inputs.ysize)

outputs:
dirty:
type: File
outputBinding:
glob: wsclean-dirty.fits

clean:
type: File
outputBinding:
glob: wsclean-clean.fits
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.