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
This commit is contained in:
@@ -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...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user