Skip to content

if defined(argument) being used for optional scalar arguments #2

@multimeric

Description

@multimeric

For example, say I wanted to generate a WDL wrapper for the --lines flag for the unix tool head:

from wdlgen import Task

inp = Task.Command.CommandInput(
    name='lines',
    prefix='--lines',
    optional=True
)

print(inp.get_string())

This generates:

~{if defined(lines) then ("--lines " +  '"' + lines + '"') else ""}

However, what I want, based on this part of the spec is the much neater:

${"--lines=" + lines}

Or, including quotes:

${'--lines="' + lines + '"'}

How can I do this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions