Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

Commit

Permalink
Merge pull request #656 from rumpl/rework-image-list
Browse files Browse the repository at this point in the history
Merge repo and tag on image list
  • Loading branch information
glours committed Oct 1, 2019
2 parents 93e0d2b + 5f39a97 commit 350ab29
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 22 deletions.
14 changes: 7 additions & 7 deletions e2e/images_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (

var (
reg = regexp.MustCompile("Digest is (.*).")
expected = `REPOSITORY TAG APP NAME
%s push-pull
a-simple-app latest simple
b-simple-app latest simple
expected = `APP IMAGE APP NAME
%s push-pull
a-simple-app:latest simple
b-simple-app:latest simple
`
)

Expand Down Expand Up @@ -48,9 +48,9 @@ func TestImageList(t *testing.T) {
dir := fs.NewDir(t, "")
defer dir.Remove()

insertBundles(t, cmd, dir, info)
digest := insertBundles(t, cmd, dir, info)

expectedOutput := fmt.Sprintf(expected, info.registryAddress+"/c-myapp")
expectedOutput := fmt.Sprintf(expected, info.registryAddress+"/c-myapp@"+digest)
cmd.Command = dockerCli.Command("app", "image", "ls")
result := icmd.RunCmd(cmd).Assert(t, icmd.Success)
assert.Equal(t, result.Stdout(), expectedOutput)
Expand Down Expand Up @@ -84,7 +84,7 @@ Deleted: b-simple-app:latest`,
Err: `Error: no such image b-simple-app:latest`,
})

expectedOutput := "REPOSITORY TAG APP NAME\n"
expectedOutput := "APP IMAGE APP NAME\n"
cmd.Command = dockerCli.Command("app", "image", "ls")
result := icmd.RunCmd(cmd).Assert(t, icmd.Success)
assert.Equal(t, result.Stdout(), expectedOutput)
Expand Down
19 changes: 4 additions & 15 deletions internal/commands/image/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ func getPackages(bundleStore store.BundleStore, references []reference.Named) ([
ref: ref,
}

if r, ok := ref.(reference.NamedTagged); ok {
pk.taggedRef = r
}

packages[i] = pk
}

Expand Down Expand Up @@ -106,14 +102,8 @@ var (
header string
value func(p pkg) string
}{
{"REPOSITORY", func(p pkg) string {
return reference.FamiliarName(p.ref)
}},
{"TAG", func(p pkg) string {
if p.taggedRef != nil {
return p.taggedRef.Tag()
}
return ""
{"APP IMAGE", func(p pkg) string {
return reference.FamiliarString(p.ref)
}},
{"APP NAME", func(p pkg) string {
return p.bundle.Name
Expand All @@ -122,7 +112,6 @@ var (
)

type pkg struct {
ref reference.Named
taggedRef reference.NamedTagged
bundle *bundle.Bundle
ref reference.Named
bundle *bundle.Bundle
}

0 comments on commit 350ab29

Please sign in to comment.