Make util ReadPassword Public

This commit is contained in:
Samuel Lorch 2022-05-30 17:51:54 +02:00
parent a8b14c959f
commit bfbc15bd0d

View file

@ -17,7 +17,8 @@ import (
"golang.org/x/term"
)
func readPassword() (string, error) {
// ReadPassword reads a Password interactively or via Pipe
func ReadPassword() (string, error) {
var fd int
var pass []byte
if term.IsTerminal(syscall.Stdin) {
@ -55,7 +56,7 @@ func GetClient(ctx context.Context) (*api.Client, error) {
userPassword := viper.GetString("userPassword")
if userPassword == "" {
cliPassword, err := readPassword()
cliPassword, err := ReadPassword()
if err != nil {
fmt.Println()
return nil, fmt.Errorf("Reading Password: %w", err)