inspectFormatWrite renders the context for a list of configs
(fmtCtx formatter.Context, refs []string, getRef inspect.GetRefFunc)
| 119 | |
| 120 | // inspectFormatWrite renders the context for a list of configs |
| 121 | func inspectFormatWrite(fmtCtx formatter.Context, refs []string, getRef inspect.GetRefFunc) error { |
| 122 | if fmtCtx.Format != configInspectPrettyTemplate { |
| 123 | return inspect.Inspect(fmtCtx.Output, refs, string(fmtCtx.Format), getRef) |
| 124 | } |
| 125 | return fmtCtx.Write(&configInspectContext{}, func(format func(subContext formatter.SubContext) error) error { |
| 126 | for _, ref := range refs { |
| 127 | configI, _, err := getRef(ref) |
| 128 | if err != nil { |
| 129 | return err |
| 130 | } |
| 131 | config, ok := configI.(swarm.Config) |
| 132 | if !ok { |
| 133 | return fmt.Errorf("got wrong object to inspect :%v", ok) |
| 134 | } |
| 135 | if err := format(&configInspectContext{Config: config}); err != nil { |
| 136 | return err |
| 137 | } |
| 138 | } |
| 139 | return nil |
| 140 | }) |
| 141 | } |
| 142 | |
| 143 | type configInspectContext struct { |
| 144 | swarm.Config |
no test coverage detected
searching dependent graphs…