mirror of
https://github.com/containers/skopeo.git
synced 2025-09-12 21:16:52 +00:00
Use cli.Context.App.Writer in the "inspect" and "standalone-verify" commands
This will make the implementations testable in the future, and prevent spreading the untestable code via copy&paste.
This commit is contained in:
@@ -43,7 +43,7 @@ var inspectCmd = cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if c.Bool("raw") {
|
if c.Bool("raw") {
|
||||||
fmt.Println(string(rawManifest))
|
fmt.Fprintln(c.App.Writer, string(rawManifest))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
imgInspect, err := img.Inspect()
|
imgInspect, err := img.Inspect()
|
||||||
@@ -77,7 +77,7 @@ var inspectCmd = cli.Command{
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Println(string(out))
|
fmt.Fprintln(c.App.Writer, string(out))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@@ -70,7 +70,6 @@ func standaloneVerify(context *cli.Context) error {
|
|||||||
|
|
||||||
mech, err := signature.NewGPGSigningMechanism()
|
mech, err := signature.NewGPGSigningMechanism()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
||||||
return fmt.Errorf("Error initializing GPG: %v", err)
|
return fmt.Errorf("Error initializing GPG: %v", err)
|
||||||
}
|
}
|
||||||
sig, err := signature.VerifyDockerManifestSignature(unverifiedSignature, unverifiedManifest, expectedDockerReference, mech, expectedFingerprint)
|
sig, err := signature.VerifyDockerManifestSignature(unverifiedSignature, unverifiedManifest, expectedDockerReference, mech, expectedFingerprint)
|
||||||
@@ -78,7 +77,7 @@ func standaloneVerify(context *cli.Context) error {
|
|||||||
return fmt.Errorf("Error verifying signature: %v", err)
|
return fmt.Errorf("Error verifying signature: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("Signature verified, digest %s\n", sig.DockerManifestDigest)
|
fmt.Fprintf(context.App.Writer, "Signature verified, digest %s\n", sig.DockerManifestDigest)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user