merger/readme.md

78 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# merger
Простейший мерджер yaml'ов
## Установка
```
go install go.neonxp.ru/merger@latest
```
## Использование
```
merger -i file1.yaml -i file2.yaml -i fileN.yaml -o output.yaml
```
Есть ещё ключи:
- `-indent 2` устанавливает отступ в результирующем yaml'е
- `-replace_arrays false` - если true то массивы по одинаковым ключам будут перезатираться. По умолчанию - соединяться.
## Пример
file1.yaml
```yaml
a1:
a11:
- one
- two
a12: "one"
a2:
a21:
- one
- two
a22: "one"
a23:
a231: 231
a232: 232
a233: 233
```
file2.yaml
```yaml
a1:
a11:
- three
- four
a12: "two"
a2:
a23:
a231: "!!!"
a232: "???"
a233:
sub: tree
to: merge
```
output.yaml
```yaml
a1:
a11:
- one
- two
- three
- four
a12: two
a2:
a21:
- one
- two
a22: one
a23:
a231: '!!!'
a232: ???
a233:
sub: tree
to: merge
```