Input arguments in specific position

I am attempting to wrap a Blender3D command into a CWL CommandLine

The blender command looks like this
blender --background --python blender_ttcam.py – -i monkey.abc -o generated_camera.abc

The difficulty I am having is that there is a need to have “–” 3rd argument

I can’t find a way to define such input that will keep CWL happy, my current attempt looks like this

#!/usr/bin/env cwl-runner
# blender --background --python blender_ttcam.py -- -i monkey.abc -o generated_camera.abc

cwlVersion: v1.0
class: CommandLineTool
baseCommand: blender
arguments: ["--background"]
inputs:
  blenderScript:
    type: string
    inputBinding:
      position: 1
      prefix: --python
  separator:
    type: null
    inputBinding:
      position: 2
      prefix: --
  inputAlembicMesh:
    type: string
    inputBinding:
      position: 3
      prefix: -i
  outputAlembicCamera:
    type: string
    inputBinding:
      position: 4
      prefix: -o
outputs:
  classfile:
    type: File
    outputBinding:
      glob: "generated_camera.abc"

When my command line is a fairly stable pattern (I notice all your inputs are required) I end up using a short bash script with parameter refrences

#!/usr/bin/env cwl-runner
# blender --background --python blender_ttcam.py -- -i monkey.abc -o generated_camera.abc

cwlVersion: v1.0
class: CommandLineTool

requirements:
  InitialWorkDirRequirement:
    listing:
      - entryname: script.sh
        entry: |-
          blender --background --python $(inputs.blenderScript) -- -i $(inputs.inputAlembicMesh) -o $(inputs.outputAlembicCamera)

baseCommand: [sh, script.sh]
arguments: []
inputs:
  blenderScript:
    type: string
  inputAlembicMesh:
    type: string
  outputAlembicCamera:
    type: string
outputs:
  classfile:
    type: File
    outputBinding:
      glob: "generated_camera.abc"

You can add an argument with a position, and you’ll want to use shellQuote: false, for example:

arguments:
- valueFrom: "--"
  position: 2
  shellQuote: false

(and remove the separator from your arguments)

2 Likes