Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on Dec 8, 2024. It is now read-only.
/yml2dotPublic archive

Turn YAML into beautiful Graph

License

NotificationsYou must be signed in to change notification settings

lucasepe/yml2dot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

Howyml2dot works?

Takes in input:

  • any YAML file
  • any text file that has YAML between comments (likefront matter)

Generates adot script forGraphviz.

Examples

Visualize aKubernetes Deployment YAML file

Given a sampledeployment.yml file:

apiVersion:apps/v1kind:Deploymentmetadata:name:nginx-deploymentlabels:app:nginxspec:replicas:3selector:matchLabels:app:nginxtemplate:metadata:labels:app:nginxspec:containers:      -name:nginximage:nginx:1.14.2ports:        -containerPort:80

Runyml2dot like this:

$ yml2dot deployment.yml| dot -Tpng> deployment.png

and create this graph:

Grab YAML info embedded in your source code

/***Box:  Object:    - set    - get***/publicclassBox {privateObjectobject;publicvoidset(Objectobject) {this.object =object;    }publicObjectget() {returnobject;    }}

Use the-from and-to flags to mark your YAML block.

Runyml2dot like this:

$ yml2dot -from'/***' -to'***/' Box.java| dot -Tpng> Box.java.png

and create this graph:

Piping YAML strings

You can also pipe YAML strings directly intoyml2dot, allowing for dynamic generation and transformation of YAML data. This is particularly useful when combiningyml2dot with other command-line tools in a Unix-style pipeline.

For example, to visualize a YAML string without creating an intermediate file:

echo"apiVersion: v1\nkind: Pod\nmetadata:\n  name: mypod"| yml2dot| dot -Tpng> mypod.png

Or, to dynamically generate a YAML configuration and immediately visualize it:

generate-yaml-config| yml2dot| dot -Tpng> config.png

This feature enhancesyml2dot's flexibility and integration into automated workflows and scripts.

How to install?

If you havegolang installed:

$ go install github.com/lucasepe/yml2dot@latest

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

[8]ページ先頭

©2009-2025 Movatter.jp