Skip to content

Commit

Permalink
fix: hide secret input during API config, fixes #232
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgtaylor committed Dec 14, 2023
1 parent 2db8c10 commit 1ecdb09
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}

Check warning on line 48 in cli/interactive.go

View check run for this annotation

Codecov / codecov/patch

cli/interactive.go#L46-L48

Added lines #L46 - L48 were not covered by tests
}

err := survey.AskOne(prompt, &resp, options...)

Check warning on line 51 in cli/interactive.go

View check run for this annotation

Codecov / codecov/patch

cli/interactive.go#L51

Added line #L51 was not covered by tests
if err == terminal.InterruptErr {
os.Exit(0)
}
Expand Down

0 comments on commit 1ecdb09

Please # to comment.