cli: podman manifest annotate --annotation use StringArray()

This option accepts arbitrary input so we should allow commas in it.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2023-12-08 18:25:00 +01:00
parent d8c3e5b3c1
commit 0f02e43cee
2 changed files with 3 additions and 3 deletions

View File

@ -31,7 +31,7 @@ func init() {
flags := annotateCmd.Flags()
annotationFlagName := "annotation"
flags.StringSliceVar(&manifestAnnotateOpts.Annotation, annotationFlagName, nil, "set an `annotation` for the specified image")
flags.StringArrayVar(&manifestAnnotateOpts.Annotation, annotationFlagName, nil, "set an `annotation` for the specified image")
_ = annotateCmd.RegisterFlagCompletionFunc(annotationFlagName, completion.AutocompleteNone)
archFlagName := "arch"

View File

@ -347,7 +347,7 @@ add_compression = ["zstd"]`), 0o644)
session = podmanTest.Podman([]string{"manifest", "add", "foo", imageListInstance})
session.WaitWithDefaultTimeout()
Expect(session).Should(ExitCleanly())
session = podmanTest.Podman([]string{"manifest", "annotate", "--annotation", "hello=world", "--arch", "bar", "foo", imageListARM64InstanceDigest})
session = podmanTest.Podman([]string{"manifest", "annotate", "--annotation", "hello=world,withcomma", "--arch", "bar", "foo", imageListARM64InstanceDigest})
session.WaitWithDefaultTimeout()
Expect(session).Should(ExitCleanly())
session = podmanTest.Podman([]string{"manifest", "inspect", "foo"})
@ -355,7 +355,7 @@ add_compression = ["zstd"]`), 0o644)
Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(ContainSubstring(`"architecture": "bar"`))
// Check added annotation
Expect(session.OutputToString()).To(ContainSubstring(`"hello": "world"`))
Expect(session.OutputToString()).To(ContainSubstring(`"hello": "world,withcomma"`))
})
It("remove digest", func() {