Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
| 1 |
package util |
| 2 |
|
| 3 |
import ( |
| 4 |
"bufio" |
| 5 |
"fmt" |
| 6 |
"os" |
| 7 |
|
| 8 |
"github.com/howeyc/gopass" |
| 9 |
) |
| 10 |
|
| 11 |
// Prompt prompts user for input with default value. |
| 12 |
func Prompt(prompt string) string { |
| 13 |
reader := bufio.NewReader(os.Stdin) |
| 14 |
fmt.Print(prompt) |
| 15 |
text, _ := reader.ReadString('\n') |
| 16 |
return text |
| 17 |
} |
| 18 |
|
| 19 |
// PromptPassword prompts user for password input. |
| 20 |
func PromptPassword(prompt string) string { |
| 21 |
fmt.Printf(prompt) |
| 22 |
b, err := gopass.GetPasswd() |
| 23 |
if err != nil { |
| 24 |
fmt.Println(err.Error()) |
| 25 |
return "" |
| 26 |
} |
| 27 |
return string(b) |
| 28 |
} |