Skip to content

Improve interaction between -x and -f eval flags #774

@cakemanny

Description

@cakemanny

When using eval's -x option, the --format option appears to be ignored.

Evaluating the following

pkl eval --format=json -x y - <<EOF            
x { 1; 2; 3 }
y { "a"; "b"; "c" }
EOF

gives

new Dynamic { "a"; "b"; "c" }

I had expected it to give

[
  "a",
  "b",
  "c"
]

Checked with Pkl 0.26.3 (macOS 14.4.1, native) and a build from main, Pkl 0.27.0-dev+9692504 (macOS 14.6.1, native).

If only always wanting a fixed format, a workaround for now is to configure both wishes in the output property.

Details

x { 1; 2; 3 }
y { "a"; "b"; "c" }

output {
  renderer = new JsonRenderer {}
  value = y
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions