mirror of
https://github.com/passbolt/go-passbolt-cli.git
synced 2025-05-12 10:58:21 +00:00
Make util ReadPassword Public
This commit is contained in:
parent
a8b14c959f
commit
bfbc15bd0d
1 changed files with 3 additions and 2 deletions
|
@ -17,7 +17,8 @@ import (
|
||||||
"golang.org/x/term"
|
"golang.org/x/term"
|
||||||
)
|
)
|
||||||
|
|
||||||
func readPassword() (string, error) {
|
// ReadPassword reads a Password interactively or via Pipe
|
||||||
|
func ReadPassword() (string, error) {
|
||||||
var fd int
|
var fd int
|
||||||
var pass []byte
|
var pass []byte
|
||||||
if term.IsTerminal(syscall.Stdin) {
|
if term.IsTerminal(syscall.Stdin) {
|
||||||
|
@ -55,7 +56,7 @@ func GetClient(ctx context.Context) (*api.Client, error) {
|
||||||
|
|
||||||
userPassword := viper.GetString("userPassword")
|
userPassword := viper.GetString("userPassword")
|
||||||
if userPassword == "" {
|
if userPassword == "" {
|
||||||
cliPassword, err := readPassword()
|
cliPassword, err := ReadPassword()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
return nil, fmt.Errorf("Reading Password: %w", err)
|
return nil, fmt.Errorf("Reading Password: %w", err)
|
||||||
|
|
Loading…
Add table
Reference in a new issue