mirror of
https://github.com/containers/podman.git
synced 2025-11-29 17:48:05 +08:00
feat: add --format flag to artifact inspect
Many commands support the `--format` flag which accept a go template to allow for formatting for certain values, but it is not yet implemented for artifact inspect command. Adding this feature will allow easy formatting in scripts as well as running it on a terminal. This feature is implemented for artifact inspect by taking reference from images and network commands implementation. Fixes: [#27112](https://github.com/containers/podman/issues/27112) Signed-off-by: Akash Yadav <akashyadav256526@gmail.com>
This commit is contained in:
@@ -636,6 +636,18 @@ var _ = Describe("Podman artifact", func() {
|
||||
// Verify we have 2 layers
|
||||
Expect(a.Manifest.Layers).To(HaveLen(2))
|
||||
})
|
||||
|
||||
It("podman artifact inspect with --format", func() {
|
||||
artifact1File, err := createArtifactFile(4192)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
artifact1Name := "localhost/test/artifact1"
|
||||
addArtifact1 := podmanTest.PodmanExitCleanly("artifact", "add", artifact1Name, artifact1File)
|
||||
|
||||
artifactDigest := addArtifact1.OutputToString()
|
||||
|
||||
podmanTest.PodmanExitCleanly("artifact", "inspect", artifactDigest, "--format", "{{.Digest}}")
|
||||
podmanTest.PodmanExitCleanly("artifact", "inspect", artifactDigest[:12], "--format", "{{.Name}}")
|
||||
})
|
||||
})
|
||||
|
||||
func digestToFilename(digest string) string {
|
||||
|
||||
Reference in New Issue
Block a user