mirror of
https://github.com/containers/skopeo.git
synced 2025-09-12 13:08:02 +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
|
||||
}
|
||||
if c.Bool("raw") {
|
||||
fmt.Println(string(rawManifest))
|
||||
fmt.Fprintln(c.App.Writer, string(rawManifest))
|
||||
return nil
|
||||
}
|
||||
imgInspect, err := img.Inspect()
|
||||
@@ -77,7 +77,7 @@ var inspectCmd = cli.Command{
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(string(out))
|
||||
fmt.Fprintln(c.App.Writer, string(out))
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
@@ -70,7 +70,6 @@ func standaloneVerify(context *cli.Context) error {
|
||||
|
||||
mech, err := signature.NewGPGSigningMechanism()
|
||||
if err != nil {
|
||||
|
||||
return fmt.Errorf("Error initializing GPG: %v", err)
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
||||
fmt.Printf("Signature verified, digest %s\n", sig.DockerManifestDigest)
|
||||
fmt.Fprintf(context.App.Writer, "Signature verified, digest %s\n", sig.DockerManifestDigest)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user