(ctx context.Context, dockerCLI command.Cli, options listOptions)
| 44 | } |
| 45 | |
| 46 | func runSecretList(ctx context.Context, dockerCLI command.Cli, options listOptions) error { |
| 47 | apiClient := dockerCLI.Client() |
| 48 | |
| 49 | res, err := apiClient.SecretList(ctx, client.SecretListOptions{Filters: options.filter.Value()}) |
| 50 | if err != nil { |
| 51 | return err |
| 52 | } |
| 53 | format := options.format |
| 54 | if len(format) == 0 { |
| 55 | if len(dockerCLI.ConfigFile().SecretFormat) > 0 && !options.quiet { |
| 56 | format = dockerCLI.ConfigFile().SecretFormat |
| 57 | } else { |
| 58 | format = formatter.TableFormatKey |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | sort.Slice(res.Items, func(i, j int) bool { |
| 63 | return sortorder.NaturalLess(res.Items[i].Spec.Name, res.Items[j].Spec.Name) |
| 64 | }) |
| 65 | |
| 66 | secretCtx := formatter.Context{ |
| 67 | Output: dockerCLI.Out(), |
| 68 | Format: newFormat(format, options.quiet), |
| 69 | } |
| 70 | return formatWrite(secretCtx, res) |
| 71 | } |
no test coverage detected
searching dependent graphs…