Skip to content

Commit 7470c35

Browse files
authored
examples for opm alpha render-graph to generate channel graph images (#1012)
* examples for to generate channel graph images Signed-off-by: Jordan Keister <[email protected]> * added details for how to avoid mermaid's maxTextSize limits Signed-off-by: Jordan Keister <[email protected]> * fixing comment Signed-off-by: Jordan Keister <[email protected]> * revised for the new render-graph command Signed-off-by: Jordan Keister <[email protected]> Signed-off-by: Jordan Keister <[email protected]>
1 parent 63c1932 commit 7470c35

File tree

1 file changed

+26
-0
lines changed
  • cmd/opm/alpha/render-graph

1 file changed

+26
-0
lines changed

cmd/opm/alpha/render-graph/cmd.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,32 @@ func NewCmd() *cobra.Command {
2222
Short: "Generate mermaid-formatted view of upgrade graph of operators in an index",
2323
Long: `Generate mermaid-formatted view of upgrade graphs of operators in an index`,
2424
Args: cobra.MinimumNArgs(1),
25+
Example: `
26+
#
27+
# Output channel graph of a catalog in mermaid format
28+
#
29+
$ opm alpha render-graph quay.io/operatorhubio/catalog:latest
30+
31+
#
32+
# Output channel graph of a catalog and generate a scaled vector graphic (SVG) representation
33+
# Note: this pipeline filters out the comments about lacking skipRange support
34+
#
35+
$ opm alpha render-graph quay.io/operatorhubio/catalog:latest | \
36+
grep -Ev '^<!--.*$' | \
37+
docker run --rm -i -v "$PWD":/data ghcr.io/mermaid-js/mermaid-cli/mermaid-cli -o /data/operatorhubio-catalog.svg
38+
39+
# Note: mermaid has a default maxTextSize of 30 000 characters. To override this, generate a JSON-formatted initialization file for
40+
# mermaid like this (using 300 000 for the limit):
41+
$ cat << EOF > ./mermaid.json
42+
{ "maxTextSize": 300000 }
43+
EOF
44+
# and then pass the file for initialization configuration, via the '-c' option, like:
45+
$ opm alpha render-graph quay.io/operatorhubio/catalog:latest | \
46+
grep -Ev '^<!--.*$' | \
47+
docker run --rm -i -v "$PWD":/data ghcr.io/mermaid-js/mermaid-cli/mermaid-cli -c /data/mermaid.json -o /data/operatorhubio-catalog.svg
48+
49+
50+
`,
2551
Run: func(cmd *cobra.Command, args []string) {
2652
// The bundle loading impl is somewhat verbose, even on the happy path,
2753
// so discard all logrus default logger logs. Any important failures will be

0 commit comments

Comments
 (0)