diff --git a/cmd/oras/internal/option/remote.go b/cmd/oras/internal/option/remote.go index d15f0ed27..90c556833 100644 --- a/cmd/oras/internal/option/remote.go +++ b/cmd/oras/internal/option/remote.go @@ -176,9 +176,9 @@ func (opts *Remote) Parse(cmd *cobra.Command) error { // optional cmd prompt. func (opts *Remote) readSecret(cmd *cobra.Command) (err error) { if cmd.Flags().Changed(identityTokenFlag) { - cmd.PrintErrln("WARNING! Using --identity-token via the CLI is insecure. Use --identity-token-stdin.") + _, _ = fmt.Fprintln(cmd.ErrOrStderr(), "WARNING! Using --identity-token via the CLI is insecure. Use --identity-token-stdin.") } else if cmd.Flags().Changed(passwordFlag) { - cmd.PrintErrln("WARNING! Using --password via the CLI is insecure. Use --password-stdin.") + _, _ = fmt.Fprintln(cmd.ErrOrStderr(), "WARNING! Using --password via the CLI is insecure. Use --password-stdin.") } else if opts.secretFromStdin { // Prompt for credential secret, err := io.ReadAll(os.Stdin) diff --git a/cmd/oras/root/discover.go b/cmd/oras/root/discover.go index 90f1f3c7f..8e3f4638d 100644 --- a/cmd/oras/root/discover.go +++ b/cmd/oras/root/discover.go @@ -18,6 +18,7 @@ package root import ( "context" "errors" + "fmt" ocispec "github.com/opencontainers/image-spec/specs-go/v1" "github.com/spf13/cobra" @@ -84,7 +85,7 @@ Example - Discover referrers of the manifest tagged 'v1' in an OCI image layout if cmd.Flags().Changed("output") { switch opts.Format.Type { case "tree", "json", "table": - cmd.PrintErrf("[DEPRECATED] --output is deprecated, try `--format %s` instead\n", opts.Template) + _, _ = fmt.Fprintf(cmd.ErrOrStderr(), "[DEPRECATED] --output is deprecated, try `--format %s` instead\n", opts.Template) default: return errors.New("output type can only be tree, table or json") }