user_guide icon indicating copy to clipboard operation
user_guide copied to clipboard

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

Open mr-c opened this issue 7 years ago • 5 comments

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.

mr-c avatar Jan 24 '18 10:01 mr-c

Moved from https://github.com/common-workflow-language/common-workflow-language/issues/68

mr-c avatar Jan 24 '18 10:01 mr-c

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: []

mr-c avatar Jul 27 '19 14:07 mr-c

enum example

cwlVersion: v1.0
class: CommandLineTool
inputs:
  one_or_the_other:
     type:
       type: enum
       symbols: [ foo, bar ]

baseCommand: echo
outputs: []

mr-c avatar Jul 27 '19 15:07 mr-c

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

mr-c avatar Jul 27 '19 15:07 mr-c

I don’t think it’s necessary to document three different ways to do it. If there’s one approach that you prefer or that you think is most accessible to beginners/non-experts, I think we should include that one only.

On Sat, 27 Jul 2019 at 17:19, Michael R. Crusoe [email protected] wrote:

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

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/common-workflow-language/user_guide/issues/89?email_source=notifications&email_token=ACJ62PEQFEJVM3MLCM45WFTQBRRPNA5CNFSM4ENME5D2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD26NJ6Q#issuecomment-515691770, or mute the thread https://github.com/notifications/unsubscribe-auth/ACJ62PDHEEEE5AQTDNWHPI3QBRRPNANCNFSM4ENME5DQ .

tobyhodges avatar Jul 28 '19 11:07 tobyhodges