Skip to content

Question: Can I pass in multiple arguments and get them included as an array? ($ARGS.positional equivalent) #2480

@planeiii-te

Description

@planeiii-te

I have a Bash array of elements that I want to end up in an array in YAML. How do I accomplish that?

The jq equivalent is $ARGS.positional. I would accomplish what I want with the followin:

➜  meh=(foo bar baz); jq --null-input '{catpants: $ARGS.positional}' --args "${meh[@]}"
{
  "catpants": [
    "foo",
    "bar",
    "baz"
  ]
}

Is this possible with yq?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions