MCPcopy
hub / github.com/docker/compose / runViz

Function runViz

cmd/compose/viz.go:68–92  ·  view source on GitHub ↗
(ctx context.Context, dockerCli command.Cli, backendOptions *BackendOptions, opts *vizOptions)

Source from the content-addressed store, hash-verified

66}
67
68func runViz(ctx context.Context, dockerCli command.Cli, backendOptions *BackendOptions, opts *vizOptions) error {
69 _, _ = fmt.Fprintln(os.Stderr, "viz command is EXPERIMENTAL")
70
71 backend, err := compose.NewComposeService(dockerCli, backendOptions.Options...)
72 if err != nil {
73 return err
74 }
75
76 project, _, err := opts.ToProject(ctx, dockerCli, backend, nil)
77 if err != nil {
78 return err
79 }
80
81 // build graph
82 graphStr, _ := backend.Viz(ctx, project, api.VizOptions{
83 IncludeNetworks: opts.includeNetworks,
84 IncludePorts: opts.includePorts,
85 IncludeImageName: opts.includeImageName,
86 Indentation: opts.indentationStr,
87 })
88
89 fmt.Println(graphStr)
90
91 return nil
92}
93
94// preferredIndentationStr returns a single string given the indentation preference
95func preferredIndentationStr(size int, useSpace bool) (string, error) {

Callers 1

vizCommandFunction · 0.85

Calls 3

NewComposeServiceFunction · 0.92
VizMethod · 0.65
ToProjectMethod · 0.45

Tested by

no test coverage detected