YAML Bundler
yamlbundler
is a useful command that bundles multiple YAML files into a single file.
It finds !include
tag in a YAML file and replaces it with the contents of another YAML file.
Install
pip install yamlbundler
Quick start
Save these files in your working directory.
a: !include ./sub1.yaml
b: !include
filepath: ./sub2.yaml
c: !include
filepath: ./sub1.yaml
jsonpath: $.foo
d: !include
- filepath: ./sub1.yaml
- filepath: ./sub2.yaml
e: !include
- filepath: ./sub1.yaml
- filepath: ./sub3.yaml
foo: bar
- one
- two
hoge: !include
filepath: ./sub2.yaml
jsonpath: $[0]
Then, run this command.
The result is shown in your terminal as STDOUT.
Comments in original YAML are removed.
yamlbundler ./main.yaml
You can save the result as a new file using --output
parameter.
If you want to overwrite the original file, use --inplace
parameter.
yamlbundler --output ./result.yaml ./main.yaml
yamlbundler --inplace ./main.yaml
Feedback
If you find any bugs, please feel free to create an issue.