yaml anchors demo
yaml anchors are:
- useful
- confusing
- hard to google for
yaml can be quite hard to read and see if it is valid.
I use 'yaml-dump' script here to just load a file and dump it as json to more easily see what it loads as.
example
yaml-dump outputs a copy of itself... so that if you paste its output to someone they can see what you did.
user@host$ yaml-dump my.yaml
$ python3 -c 'import json, sys, yaml; print(json.dumps(yaml.safe_load(open(sys.argv[1])), indent=1, sort_keys=True) + "\n")' /tmp/my.yaml
{
"_myanchors_name_does_not_matter": [
"this is the content of blob1\n"
],
"key1": "this is the content of blob1\n"
}