exec cue cmd execEnv
cmp stdout stdout.golden

-- cue.mod/module.cue --
module: "example.com"
language: version: "v0.9.0"

-- stdout.golden --
usesDefaultsStruct: hello from John Doe

usesDefaultsList: hello from John Doe

-- foo_tool.cue --
package foo

import (
	"tool/cli"
	"tool/exec"
)

#messageText: *"hello" | string
message: *"MESSAGE=\(#messageText)" | string

command: execEnv: {
    usesDefaultsStruct: exec.Run & {
        cmd: ["sh", "-c", "echo $MESSAGE from $SENDER"]
        stdout: *"" | string
        env: {
            MESSAGE: #messageText
            SENDER: *"John Doe" | string
        }
    }
    usesDefaultsList: exec.Run & {
        cmd: ["sh", "-c", "echo $MESSAGE from $SENDER"]
        stdout: *"" | string
        env: [message, *"SENDER=John Doe" | string ]
    }
    result: cli.Print & {
        text: """
        usesDefaultsStruct: \(usesDefaultsStruct.stdout)
        usesDefaultsList: \(usesDefaultsList.stdout)
        """
    }
}
