| 7 | ) |
| 8 | |
| 9 | func cacheLsCmd() *cobra.Command { |
| 10 | cmd := &cobra.Command{ |
| 11 | Use: "ls", |
| 12 | Short: "list images in the linuxkit cache", |
| 13 | Long: `List images in the linuxkit cache.`, |
| 14 | RunE: func(cmd *cobra.Command, args []string) error { |
| 15 | // list all of the images and content in the cache |
| 16 | images, err := cachepkg.ListImages(cacheDir) |
| 17 | if err != nil { |
| 18 | log.Fatalf("error reading image names: %v", err) |
| 19 | } |
| 20 | log.Printf("%-80s %s", "image name", "root manifest hash") |
| 21 | for name, hash := range images { |
| 22 | log.Printf("%-80s %s", name, hash) |
| 23 | } |
| 24 | return nil |
| 25 | }, |
| 26 | } |
| 27 | return cmd |
| 28 | } |