common-workflow-language icon indicating copy to clipboard operation
common-workflow-language copied to clipboard

CommandInputRecordField needs `default` field

Open tom-tan opened this issue 6 years ago • 1 comments

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?

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.

tom-tan avatar Mar 06 '18 06:03 tom-tan

This issue has been mentioned on Common Workflow Language Discourse. There might be relevant details there:

https://cwl.discourse.group/t/creating-config-json-file-from-a-record/172/3

cwl-bot avatar Jul 30 '20 10:07 cwl-bot