cli: podman manifest add --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:
parent
3e10a68328
commit
d8c3e5b3c1
|
@ -48,7 +48,7 @@ func init() {
|
||||||
flags.BoolVar(&manifestAddOpts.All, "all", false, "add all of the list's images if the image is a list")
|
flags.BoolVar(&manifestAddOpts.All, "all", false, "add all of the list's images if the image is a list")
|
||||||
|
|
||||||
annotationFlagName := "annotation"
|
annotationFlagName := "annotation"
|
||||||
flags.StringSliceVar(&manifestAddOpts.Annotation, annotationFlagName, nil, "set an `annotation` for the specified image")
|
flags.StringArrayVar(&manifestAddOpts.Annotation, annotationFlagName, nil, "set an `annotation` for the specified image")
|
||||||
_ = addCmd.RegisterFlagCompletionFunc(annotationFlagName, completion.AutocompleteNone)
|
_ = addCmd.RegisterFlagCompletionFunc(annotationFlagName, completion.AutocompleteNone)
|
||||||
|
|
||||||
archFlagName := "arch"
|
archFlagName := "arch"
|
||||||
|
|
|
@ -314,7 +314,7 @@ add_compression = ["zstd"]`), 0o644)
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(125))
|
Expect(session).Should(Exit(125))
|
||||||
Expect(session.ErrorToString()).To(ContainSubstring("no value given for annotation"))
|
Expect(session.ErrorToString()).To(ContainSubstring("no value given for annotation"))
|
||||||
session = podmanTest.Podman([]string{"manifest", "add", "--annotation", "hoge=fuga", "foo", imageList})
|
session = podmanTest.Podman([]string{"manifest", "add", "--annotation", "hoge=fuga", "--annotation", "key=val,withcomma", "foo", imageList})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(ExitCleanly())
|
Expect(session).Should(ExitCleanly())
|
||||||
session = podmanTest.Podman([]string{"manifest", "inspect", "foo"})
|
session = podmanTest.Podman([]string{"manifest", "inspect", "foo"})
|
||||||
|
@ -324,7 +324,7 @@ add_compression = ["zstd"]`), 0o644)
|
||||||
var inspect define.ManifestListData
|
var inspect define.ManifestListData
|
||||||
err := json.Unmarshal(session.Out.Contents(), &inspect)
|
err := json.Unmarshal(session.Out.Contents(), &inspect)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(inspect.Manifests[0].Annotations).To(Equal(map[string]string{"hoge": "fuga"}))
|
Expect(inspect.Manifests[0].Annotations).To(Equal(map[string]string{"hoge": "fuga", "key": "val,withcomma"}))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("add --os", func() {
|
It("add --os", func() {
|
||||||
|
|
Loading…
Reference in New Issue