(ctx context.Context, dockerCli command.Cli, backendOptions *BackendOptions, opts *vizOptions)
| 66 | } |
| 67 | |
| 68 | func 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 |
| 95 | func preferredIndentationStr(size int, useSpace bool) (string, error) { |
no test coverage detected