Fix 'secret get' to output to stdout instead of stderr

- Add Print method to CLI Instance that uses cmd.OutOrStdout()
- Update GetSecretWithVersion to use cli.Print instead of cmd.Print
- Add test to verify secret values go to stdout, not stderr
- Store command reference in Instance for proper output handling
Bu işleme şunda yer alıyor:
2025-07-29 20:01:10 +02:00
ebeveyn b301a414cb
işleme 18fb79e971
3 değiştirilmiş dosya ile 84 ekleme ve 2 silme
+7
Dosyayı Görüntüle
@@ -2,6 +2,8 @@
package cli
import (
"fmt"
"git.eeqj.de/sneak/secret/internal/secret"
"github.com/spf13/afero"
"github.com/spf13/cobra"
@@ -57,3 +59,8 @@ func (cli *Instance) SetStateDir(stateDir string) {
func (cli *Instance) GetStateDir() string {
return cli.stateDir
}
// Print outputs to the command's configured output writer
func (cli *Instance) Print(a ...interface{}) (n int, err error) {
return fmt.Fprint(cli.cmd.OutOrStdout(), a...)
}