From 1109927984771811dd230cdbff15131eea81d2af Mon Sep 17 00:00:00 2001 From: Calliope <30454698+c4lliope@users.noreply.github.com> Date: Tue, 25 Feb 2025 15:51:44 -0500 Subject: [PATCH] [ease-of-use] Display "Enter Password" on STDERR This enables users to sequence `passbolt` commands ahead of common processors... such as: ``` passbolt list resource | fzf passbolt get resource -j abc-123-321-cba | jq ".Password" ``` As is, displaying the prompt on STDIN means the prompt (and occasionally user response) is gobbled up by the second command in the sequence. STDERR is a common out-of-band backup for interactive prompts in many similar cases. I am inexperienced in Golang, and am unsure how solid this is; simply queried the ideal API call. --- util/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/client.go b/util/client.go index 060f985..3070b4d 100644 --- a/util/client.go +++ b/util/client.go @@ -22,7 +22,7 @@ func ReadPassword(prompt string) (string, error) { fd := int(os.Stdin.Fd()) var pass string if term.IsTerminal(fd) { - fmt.Print(prompt) + fmt.Fprint(os.Stderr, prompt); inputPass, err := term.ReadPassword(fd) if err != nil {