mirror of
https://github.com/passbolt/go-passbolt-cli.git
synced 2025-05-12 19:08:21 +00:00
[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.
This commit is contained in:
parent
1183813dcb
commit
1109927984
1 changed files with 1 additions and 1 deletions
|
@ -22,7 +22,7 @@ func ReadPassword(prompt string) (string, error) {
|
||||||
fd := int(os.Stdin.Fd())
|
fd := int(os.Stdin.Fd())
|
||||||
var pass string
|
var pass string
|
||||||
if term.IsTerminal(fd) {
|
if term.IsTerminal(fd) {
|
||||||
fmt.Print(prompt)
|
fmt.Fprint(os.Stderr, prompt);
|
||||||
|
|
||||||
inputPass, err := term.ReadPassword(fd)
|
inputPass, err := term.ReadPassword(fd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Add table
Reference in a new issue