BooleanFlagParameter

API: Internal/Beta

Produces a toggleable command-line flag

data class BooleanFlagParameter(
    val variableName: String,
    val flag: String,
    val type: String /* "bool_flag" */,
)

The parameter referenced by variableName must be of type ApplicationParameter.Bool, and the value must be AppParamValue.Bool. This invocation parameter will produce the flag if the variable’s value is true. Otherwise, it will produce no values.

Example: Example (with true value)

VariableInvocationParameter:

{
    "type": "bool_flag",
    "variableName": ["myVariable"],
    "flag": "--example"
}

Values (AppParameterValue):

{
    "myVariable": { "type": "bool", "value": true }
}

Expands to:

"--example"

Example: Example (with false value)

VariableInvocationParameter:

{
    "type": "bool_flag",
    "variableName": ["myVariable"],
    "flag": "--example"
}

Values (AppParameterValue):

{
    "myVariable": { "type": "bool", "value": false }
}

Expands to (nothing):


Example: With spaces

VariableInvocationParameter:

{
    "type": "bool_flag",
    "variableName": ["myVariable"],
    "flag": "--hello world"
}

Values (AppParameterValue):

{
    "myVariable": { "type": "bool", "value": true }
}

Expands to:

"--hello world"
Properties
variableName: String
flag: String
type: String /* "bool_flag" */ The type discriminator

API: Stable