78 lines
1.1 KiB
Markdown
78 lines
1.1 KiB
Markdown
# 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
|
||
``` |