Skip to content

Commit

Permalink
Merge pull request #233 from danielgtaylor/hide-secrets-input
Browse files Browse the repository at this point in the history
fix: hide secret input during API config, fixes #232
  • Loading branch information
danielgtaylor committed Dec 14, 2023
2 parents 2db8c10 + 1ecdb09 commit 21a9017
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cli/interactive.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ func (a defaultAsker) askInput(message string, def string, required bool, help s
message += " (optional)"
}

err := survey.AskOne(&survey.Input{Message: message, Default: def, Help: help}, &resp, options...)
var prompt survey.Prompt = &survey.Input{Message: message, Default: def, Help: help}
if strings.Contains(message, "password") || strings.Contains(message, "secret") {
prompt = &survey.Password{Message: message, Help: help}
}

err := survey.AskOne(prompt, &resp, options...)
if err == terminal.InterruptErr {
os.Exit(0)
}
Expand Down

0 comments on commit 21a9017

Please sign in to comment.