From c19f7d4da71300d739f21d51efbeb950e2cbe7d9 Mon Sep 17 00:00:00 2001 From: Nick Adcock Date: Wed, 6 Nov 2019 20:30:17 +0000 Subject: [PATCH] dont show id as repository in image ls When running `image ls` images without a repository no longer print their ID as their repository. Signed-off-by: Nick Adcock --- internal/commands/image/list.go | 2 +- internal/commands/image/list_test.go | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/commands/image/list.go b/internal/commands/image/list.go index 0dd71ec25..c386cd71b 100644 --- a/internal/commands/image/list.go +++ b/internal/commands/image/list.go @@ -148,7 +148,7 @@ func getImageListColumns(options imageListOption) []imageListColumn { if n, ok := p.ref.(reference.Named); ok { return reference.FamiliarName(n) } - return reference.FamiliarString(p.ref) + return "" }}, {"TAG", func(p pkg) string { if t, ok := p.ref.(reference.Tagged); ok { diff --git a/internal/commands/image/list_test.go b/internal/commands/image/list_test.go index a64ee7a27..0bc57fa86 100644 --- a/internal/commands/image/list_test.go +++ b/internal/commands/image/list_test.go @@ -75,19 +75,19 @@ func TestListCmd(t *testing.T) { }{ { name: "TestList", - expectedOutput: `REPOSITORY TAG APP IMAGE ID APP NAME -foo/bar 3f825b2d0657 Digested App -foo/bar 1.0 9aae408ee04f Foo App -a855ac937f2ed375ba4396bbc49c4093e124da933acd2713fb9bc17d7562a087 a855ac937f2e Quiet App + expectedOutput: `REPOSITORY TAG APP IMAGE ID APP NAME +foo/bar 3f825b2d0657 Digested App +foo/bar 1.0 9aae408ee04f Foo App + a855ac937f2e Quiet App `, options: imageListOption{}, }, { name: "TestListWithDigests", - expectedOutput: `REPOSITORY TAG DIGEST APP IMAGE ID APP NAME -foo/bar sha256:b59492bb814012ca3d2ce0b6728242d96b4af41687cc82166a4b5d7f2d9fb865 3f825b2d0657 Digested App -foo/bar 1.0 9aae408ee04f Foo App -a855ac937f2ed375ba4396bbc49c4093e124da933acd2713fb9bc17d7562a087 sha256:a855ac937f2ed375ba4396bbc49c4093e124da933acd2713fb9bc17d7562a087 a855ac937f2e Quiet App + expectedOutput: `REPOSITORY TAG DIGEST APP IMAGE ID APP NAME +foo/bar sha256:b59492bb814012ca3d2ce0b6728242d96b4af41687cc82166a4b5d7f2d9fb865 3f825b2d0657 Digested App +foo/bar 1.0 9aae408ee04f Foo App + sha256:a855ac937f2ed375ba4396bbc49c4093e124da933acd2713fb9bc17d7562a087 a855ac937f2e Quiet App `, options: imageListOption{digests: true}, },