Skip to content

Commit

Permalink
Display remote policies that have no content pushed
Browse files Browse the repository at this point in the history
  • Loading branch information
viovanov committed Oct 8, 2021
1 parent 9d8e57e commit af35a48
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions pkg/app/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ func (c *PolicyApp) ImagesRemote(server string) error {
return err
}

table := c.UI.Normal().WithTable("Repository", "Tag")
p := c.UI.Progress("Fetching tags for images")
p.Start()

imageData := [][]string{}
for _, image := range images {
repo := server + "/" + image

Expand All @@ -117,10 +120,26 @@ func (c *PolicyApp) ImagesRemote(server string) error {
return err
}

if len(tags) == 0 {
imageData = append(imageData, []string{familiarName, "<no tags>"})
continue
}

for _, tag := range tags {
table.WithTableRow(familiarName, tag)
imageData = append(imageData, []string{familiarName, tag})
}
}

p.Stop()

sort.SliceStable(imageData, func(i, j int) bool {
return imageData[i][0] < imageData[j][0] || (imageData[i][0] == imageData[j][0] && imageData[i][1] < imageData[j][1])
})

table := c.UI.Normal().WithTable("Repository", "Tag")
for _, image := range imageData {
table.WithTableRow(image[0], image[1])
}
table.Do()

// Get a list of tags for each image
Expand Down

0 comments on commit af35a48

Please sign in to comment.