fusion

command module
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2025 License: MIT Imports: 1 Imported by: 0

README

fusion

Release License Go version Test status GolangCI status

fusion is CLI tool to merge JSON, YAML or TOML files.

Installation

Download from the Releases page and put it somewhere in your $PATH.

Usage

Merge YAML files together with:

❯ fusion yaml file1.yml file2.yml ... fileN.yml -o result.yml

The same goes for JSON or TOML files, simply use the appropriate sub-command. E.g.

❯ fusion json file1.json file2.json ... fileN.json -o result.json

Note that since YAML is a superset of JSON, merging YAML and JSON files into YAML is also possible:

❯ fusion yaml file1.yml file2.json ... fileN.yml -o result.yml

Versioning

The versioning is done using semver.

When a new release must be performed, use mroth/bump to create a Git tag and the corresponding Github release, then, once pushed, the Goreleaser Github Action workflow will create the binaries.

The version can be checked with

❯ fusion version

Merging semantics

Fusion is based on gookit/config, itself based on imdario/mergo. Therefore, merge rules are the one implemented by Mergo.

Single key/value

Only the last value is retained. For example:

❯ cat file1.yml
key1: val1

❯ cat file2.yml
key1: val2

❯ fusion yaml file1.yml file2.yml -o res.yml && cat res.yml
key1: val2
Lists

Just like single values, only the last value of conflicting lists is retained. For example:

❯ cat file1.yml
list1:
  - val11
  - val12

❯ cat file2.yml
list1:
  - val21
  - val22

❯ fusion yaml file1.yml file2.yml -o res.yml && cat res.yml
list1:
  - val21
  - val22
Maps

Maps are merged together, keeping the last value for conflicting keys. For example:

❯ cat file1.yml
map1:
  key1: val11
  key2: val12

❯ cat file2.yml
map1:
  key1: val21
  key3: val23

❯ fusion yaml file1.yml file2.yml -o res.yml && cat res.yml
map1:
  key1: val21
  key2: val12
  key3: val23

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL