Skip to content

document how to model a one-or-the-other parameter #89

Open

Description

@mr-c

From https://groups.google.com/d/msg/common-workflow-language/t7GEjKwJHys/2BvtkhsjXxMJ

> I'm not seeing how to model a boolean so that both 'true' and 'false' result
> in differents strings being added to the command line.

One way to do this is to define an "enum" where the symbols are the
two alternate command line flags.  Another way is to use an expression
that overrides the default handling of boolean.  A third way would be
to define two types with the command line flag in inputBinding.prefix
and use a union.

Activity

  1. mr-c commented on Jan 24, 2018

    @mr-c
    MemberAuthor
  2. added
    for miscellaneous page
    on Jul 27, 2019
  3. mr-c commented on Jul 27, 2019

    @mr-c
    MemberAuthor

    expression example:

    cwlVersion: v1.0
    class: CommandLineTool
    requirements:
      InlineJavascriptRequirement: {}
    inputs:
      fancy_bool:
         type: boolean
         default: false  # or true
         inputBinding:
            valueFrom: ${if (self) { return "foo";} else { return "bar";}}
    
    baseCommand: echo
    
    outputs: []
  4. mr-c commented on Jul 27, 2019

    @mr-c
    MemberAuthor

    enum example

    cwlVersion: v1.0
    class: CommandLineTool
    inputs:
      one_or_the_other:
         type:
           type: enum
           symbols: [ foo, bar ]
    
    baseCommand: echo
    outputs: []
  5. reopened this on Jul 27, 2019
  6. mr-c commented on Jul 27, 2019

    @mr-c
    MemberAuthor

    way "1" and "3" still need adding to the docs

  7. tobyhodges commented on Jul 28, 2019

    @tobyhodges
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    for miscellaneous page

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions