(ctx context.Context, dockerCli command.Cli, options listOptions)
| 47 | } |
| 48 | |
| 49 | func runList(ctx context.Context, dockerCli command.Cli, options listOptions) error { |
| 50 | resp, err := dockerCli.Client().PluginList(ctx, client.PluginListOptions{ |
| 51 | Filters: options.filter.Value(), |
| 52 | }) |
| 53 | if err != nil { |
| 54 | return err |
| 55 | } |
| 56 | |
| 57 | sort.Slice(resp.Items, func(i, j int) bool { |
| 58 | return sortorder.NaturalLess(resp.Items[i].Name, resp.Items[j].Name) |
| 59 | }) |
| 60 | |
| 61 | format := options.format |
| 62 | if len(format) == 0 { |
| 63 | if len(dockerCli.ConfigFile().PluginsFormat) > 0 && !options.quiet { |
| 64 | format = dockerCli.ConfigFile().PluginsFormat |
| 65 | } else { |
| 66 | format = formatter.TableFormatKey |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | pluginsCtx := formatter.Context{ |
| 71 | Output: dockerCli.Out(), |
| 72 | Format: newFormat(format, options.quiet), |
| 73 | Trunc: !options.noTrunc, |
| 74 | } |
| 75 | return formatWrite(pluginsCtx, resp) |
| 76 | } |
no test coverage detected
searching dependent graphs…