herrjulz / aviator

Merge YAML/JSON files in a in a convenient fashion based on a configuration file called aviator.yml
MIT License
60 stars 7 forks source link

Merge not merging? #45

Closed Infinoid closed 3 years ago

Infinoid commented 3 years ago

Hi,

Trying out this tool and I have a stupid question. Why doesn't merge merge?

thing1.yaml:

a:
  b: c

thing2.yaml:

a:
  d: e

spruce merge does what I expect:

$ spruce merge thing1.yaml thing2.yaml
a:
  b: c
  d: e

But aviator seems to ignore the second file.

$ cat aviator.yml
spruce:
  - base: thing1.yaml
    merge:
    - with:
      files:
      - thing2.yaml
    to: things.yaml
$ aviator
SPRUCE MERGE:
    thing1.yaml
    to: things.yaml

$ cat things.yaml
a:
  b: c

Why didn't the contents of thing2.yaml get merged into the output?

herrjulz commented 3 years ago

Hi @Infinoid , sorry for my late response. I really need to get better at monitoring the issues on Aviator. Anyways, I hope I'm not to late to this and thank you very much for trying out aviator!

The only problem is that your aviator.yaml has a small yaml syntax issue. You need to indent the files section inside the merge section. Like this:

spruce:
  - base: thing1.yaml
    merge:
    - with:
        files:
        - thing2.yaml
    to: things.yaml

files is a part of with. To make it more clear probably that part in JSON helps:

[{
  with: { 
     files: [myfile.yml]
  }
}] 

Let me know if that helped!

I can absolutely see that the confusion might come from the README. I saw examples where the indentation is missing. I'm fixing it right away!

Thank you for opening this issue.

Infinoid commented 3 years ago

You're right, that was my problem. It seems to be behaving better now. And yes, I was basing my work on the examples in the README.

Thanks!