Skip to content

Another merge question #779

@lyandr

Description

@lyandr

hello @mikefarah,

thanks for your answer about my first question. But i have another question. I want to merge the following files:

file1.yml

a:
  - b:
    - c:
      - foo: bar

file2.yml

a:
  - b:
    - c:
      - bar: foo

file3.yml

a:
  - c:
    - john: doe

If i run a merge with yq ea -M '. as $item ireduce({}; . *d $item)' file1.yml file2.yml file3.yml i have the following result:

a:
  - b:
      - c:
          - foo: bar
            bar: foo
    c:
      - john: doe

I know that the result is a valid yaml result, but for some reasons mkdocs rise an error during the mkdocs.yml parsing. So the
wanted result is the following:

a:
  - b:
      - c:
          - foo: bar
          - bar: foo
  - c:
      - john: doe

Is it possible to obtain a "-" on each entries of an array? Thanks for your help.

Regards
Lyandr

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