Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mr-c opened this issue Jan 24, 2018 · 5 comments · Fixed by #156
Open

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

mr-c opened this issue Jan 24, 2018 · 5 comments · Fixed by #156
Labels
for miscellaneous page things to be added to a _extras/miscellaneous page

Comments

@mr-c
Copy link
Member

mr-c commented Jan 24, 2018

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
Copy link
Member Author

mr-c commented Jan 24, 2018

@mr-c
Copy link
Member Author

mr-c commented Jul 27, 2019

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
Copy link
Member Author

mr-c commented Jul 27, 2019

enum example

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

baseCommand: echo
outputs: []

@mr-c
Copy link
Member Author

mr-c commented Jul 27, 2019

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

@tobyhodges
Copy link
Contributor

tobyhodges commented Jul 28, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for miscellaneous page things to be added to a _extras/miscellaneous page
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants