cli/command/images: runImages: use proper camel-case for dockerCLI

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2024-02-03 17:56:06 +01:00
parent 1328bb3381
commit b158181a1d
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 9 additions and 9 deletions

View File

@ -24,7 +24,7 @@ type imagesOptions struct {
} }
// NewImagesCommand creates a new `docker images` command // NewImagesCommand creates a new `docker images` command
func NewImagesCommand(dockerCli command.Cli) *cobra.Command { func NewImagesCommand(dockerCLI command.Cli) *cobra.Command {
options := imagesOptions{filter: opts.NewFilterOpt()} options := imagesOptions{filter: opts.NewFilterOpt()}
cmd := &cobra.Command{ cmd := &cobra.Command{
@ -35,7 +35,7 @@ func NewImagesCommand(dockerCli command.Cli) *cobra.Command {
if len(args) > 0 { if len(args) > 0 {
options.matchName = args[0] options.matchName = args[0]
} }
return runImages(cmd.Context(), dockerCli, options) return runImages(cmd.Context(), dockerCLI, options)
}, },
Annotations: map[string]string{ Annotations: map[string]string{
"category-top": "7", "category-top": "7",
@ -55,20 +55,20 @@ func NewImagesCommand(dockerCli command.Cli) *cobra.Command {
return cmd return cmd
} }
func newListCommand(dockerCli command.Cli) *cobra.Command { func newListCommand(dockerCLI command.Cli) *cobra.Command {
cmd := *NewImagesCommand(dockerCli) cmd := *NewImagesCommand(dockerCLI)
cmd.Aliases = []string{"list"} cmd.Aliases = []string{"list"}
cmd.Use = "ls [OPTIONS] [REPOSITORY[:TAG]]" cmd.Use = "ls [OPTIONS] [REPOSITORY[:TAG]]"
return &cmd return &cmd
} }
func runImages(ctx context.Context, dockerCli command.Cli, options imagesOptions) error { func runImages(ctx context.Context, dockerCLI command.Cli, options imagesOptions) error {
filters := options.filter.Value() filters := options.filter.Value()
if options.matchName != "" { if options.matchName != "" {
filters.Add("reference", options.matchName) filters.Add("reference", options.matchName)
} }
images, err := dockerCli.Client().ImageList(ctx, image.ListOptions{ images, err := dockerCLI.Client().ImageList(ctx, image.ListOptions{
All: options.all, All: options.all,
Filters: filters, Filters: filters,
}) })
@ -78,8 +78,8 @@ func runImages(ctx context.Context, dockerCli command.Cli, options imagesOptions
format := options.format format := options.format
if len(format) == 0 { if len(format) == 0 {
if len(dockerCli.ConfigFile().ImagesFormat) > 0 && !options.quiet { if len(dockerCLI.ConfigFile().ImagesFormat) > 0 && !options.quiet {
format = dockerCli.ConfigFile().ImagesFormat format = dockerCLI.ConfigFile().ImagesFormat
} else { } else {
format = formatter.TableFormatKey format = formatter.TableFormatKey
} }
@ -87,7 +87,7 @@ func runImages(ctx context.Context, dockerCli command.Cli, options imagesOptions
imageCtx := formatter.ImageContext{ imageCtx := formatter.ImageContext{
Context: formatter.Context{ Context: formatter.Context{
Output: dockerCli.Out(), Output: dockerCLI.Out(),
Format: formatter.NewImageFormat(format, options.quiet, options.showDigests), Format: formatter.NewImageFormat(format, options.quiet, options.showDigests),
Trunc: !options.noTrunc, Trunc: !options.noTrunc,
}, },