common-workflow-language / common-workflow-language/common-workflow-language
CommandInputRecordField needs `default` field
- Dominant language
- Common Workflow Language
- Stars
- 1.5k
- Forks
- 193
- PR merge metrics
- No merged PRs in 30d
Description
`cwltool` behaves the default value of optional boolean parameters as `false` (I am not sure it is described in the spec) but sometimes we want to set `true` as default for several parameters.
We can use `default` field for the usual parameters but it is not provided for `CommandInputRecordField`.
Is there a way to set the default value for exclusive parameters or am I missing something?
---
Here is a simple example (`wc.cwl`) to show what I want.
It supports the following exclusive options:
- `help`: a parameter to show the help message
- `version`: a parameter to show the version
- `bytes`, `chars`, `lines` and `input`: parameters for usual case
How to write to set the default value of `bytes` `true`?
```cwl
cwlVersion: v1.0
class: CommandLineTool
requirements:
DockerRequirement:
dockerPull: ubuntu
baseCommand: wc
inputs:
mode:
type:
- type: record
name: help-mode
fields:
help:
type: boolean
inputBinding:
prefix: --help
- type: record
name: version-mode
fields:
version:
type: boolean
inputBinding:
prefix: --version
- type: record
name: main-mode
fields:
bytes:
type: boolean?
inputBinding:
prefix: -c
chars:
type: boolean?
inputBinding:
prefix: -m
lines:
type: boolean?
inputBinding:
prefix: -l
input:
type: File
inputBinding: {}
outputs: []
```
Note: #428 is a similar but different issue. #428 is for the default value of record type but this issue is about the default value of specific fields in record object.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the `wc.cwl` example and compare this request with issue #428, then check how `cwltool` currently handles optional boolean fields in `CommandInputRecordField`. Done should define and implement a clear way to express field-specific defaults, with the example demonstrating `bytes` defaulting to `true`.
Written by the indexing model from the issue text.
Assessment
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100