fix: replace gopass lib with golang.org/x/term (#674)

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Ryan (hackercat)
2021-05-06 22:13:14 +02:00
committed by GitHub
parent a144e71a1b
commit a6a865e973
3 changed files with 6 additions and 8 deletions

View File

@@ -2,11 +2,11 @@ package cmd
import (
"fmt"
"log"
"os"
"strings"
"github.com/howeyc/gopass"
log "github.com/sirupsen/logrus"
"golang.org/x/term"
)
type secrets map[string]string
@@ -17,7 +17,7 @@ func newSecrets(secretList []string) secrets {
secretPairParts := strings.SplitN(secretPair, "=", 2)
secretPairParts[0] = strings.ToUpper(secretPairParts[0])
if strings.ToUpper(s[secretPairParts[0]]) == secretPairParts[0] {
log.Fatalf("Secret %s is already defined (secrets are case insensitive)", secretPairParts[0])
log.Errorf("Secret %s is already defined (secrets are case insensitive)", secretPairParts[0])
}
if len(secretPairParts) == 2 {
s[secretPairParts[0]] = secretPairParts[1]
@@ -25,9 +25,10 @@ func newSecrets(secretList []string) secrets {
s[secretPairParts[0]] = env
} else {
fmt.Printf("Provide value for '%s': ", secretPairParts[0])
val, err := gopass.GetPasswdMasked()
val, err := term.ReadPassword(int(os.Stdin.Fd()))
if err != nil {
log.Fatal("abort")
log.Errorf("failed to read input: %v", err)
os.Exit(1)
}
s[secretPairParts[0]] = string(val)
}