From 00f8d32ef5ae97de239c008327c041b992c40f11 Mon Sep 17 00:00:00 2001 From: Mike Brown Date: Mon, 19 Apr 2021 15:09:09 -0500 Subject: [PATCH] add not found debug out for check cmd; update usage Signed-off-by: Mike Brown --- cmd/ctr/commands/images/images.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/cmd/ctr/commands/images/images.go b/cmd/ctr/commands/images/images.go index 05fec7ac0..3ec0492ae 100644 --- a/cmd/ctr/commands/images/images.go +++ b/cmd/ctr/commands/images/images.go @@ -199,9 +199,9 @@ var setLabelsCommand = cli.Command{ var checkCommand = cli.Command{ Name: "check", - Usage: "check that an image has all content available locally", + Usage: "check existing images to ensure all content is available locally", ArgsUsage: "[flags] [, ...]", - Description: "check that an image has all content available locally", + Description: "check existing images to ensure all content is available locally", Flags: commands.SnapshotterFlags, Action: func(context *cli.Context) error { var ( @@ -212,17 +212,21 @@ var checkCommand = cli.Command{ return err } defer cancel() - var ( - contentStore = client.ContentStore() - tw = tabwriter.NewWriter(os.Stdout, 1, 8, 1, ' ', 0) - ) - fmt.Fprintln(tw, "REF\tTYPE\tDIGEST\tSTATUS\tSIZE\tUNPACKED\t") + + var contentStore = client.ContentStore() args := []string(context.Args()) imageList, err := client.ListImages(ctx, args...) if err != nil { return errors.Wrap(err, "failed listing images") } + if len(imageList) == 0 { + log.G(ctx).Debugf("no images found") + return exitErr + } + + var tw = tabwriter.NewWriter(os.Stdout, 1, 8, 1, ' ', 0) + fmt.Fprintln(tw, "REF\tTYPE\tDIGEST\tSTATUS\tSIZE\tUNPACKED\t") for _, image := range imageList { var (