fix: print prompt to stderr.

This commit is contained in:
fiatjaf 2024-02-02 14:13:11 -03:00
parent bda18e035a
commit 0b9e861f90
No known key found for this signature in database
GPG Key ID: BAD43C4BE5C1A3A1

View File

@ -182,6 +182,7 @@ func promptDecrypt(ncryptsec1 string) (string, error) {
func ask(msg string, defaultValue string, shouldAskAgain func(answer string) bool) (string, error) { func ask(msg string, defaultValue string, shouldAskAgain func(answer string) bool) (string, error) {
return _ask(&readline.Config{ return _ask(&readline.Config{
Stdout: os.Stderr,
Prompt: color.YellowString(msg), Prompt: color.YellowString(msg),
InterruptPrompt: "^C", InterruptPrompt: "^C",
DisableAutoSaveHistory: true, DisableAutoSaveHistory: true,
@ -190,6 +191,7 @@ func ask(msg string, defaultValue string, shouldAskAgain func(answer string) boo
func askPassword(msg string, shouldAskAgain func(answer string) bool) (string, error) { func askPassword(msg string, shouldAskAgain func(answer string) bool) (string, error) {
config := &readline.Config{ config := &readline.Config{
Stdout: os.Stderr,
Prompt: color.YellowString(msg), Prompt: color.YellowString(msg),
InterruptPrompt: "^C", InterruptPrompt: "^C",
DisableAutoSaveHistory: true, DisableAutoSaveHistory: true,