yml2dot - Turn YAML into beautiful Graph
Use Cases
- Visualize your YAML files as Graph
- Generate additional info from your source code (simply define a YAML block and use this tool)
yml2dot works?
HowTakes in input:
- any YAML file
- any text file that has YAML between comments (like front matter)
Generates a dot script for Graphviz.
Examples
docker-compose YAML file
Visualize aGiven a sample docker-compose.yml
file:
version: "3.9"
services:
redis:
image: redis:latest
deploy:
replicas: 1
configs:
- source: my_config
target: /redis_config
uid: '103'
gid: '103'
mode: 0440
configs:
my_config:
file: ./my_config.txt
my_other_config:
external: true
Run yml2dot like this:
$ yml2dot docker-compose-sample.yml | dot -Tpng > docker-compose-sample.yml.png
and create this graph:
Grab YAML info embedded in your source code
/***
Box:
Object:
- set
- get
***/
public class Box {
private Object object;
public void set(Object object) {
this.object = object;
}
public Object get() {
return object;
}
}
Use the
-from
and-to
flags to mark your YAML block.
Run yml2dot like this:
$ yml2dot -from '/***' -to '***/' Box.java | dot -Tpng > Box.java.png
and create this graph:
How to install?
In order to use the yml2dot
command, compile it using the following command:
go get -u github.com/lucasepe/yml2dot
This will create the executable under your $GOPATH/bin directory.
Ready-To-Use Releases
If you don't want to compile the sourcecode yourself, Here you can find the tool already compiled for:
- MacOS
- Linux
- Windows