remove unused printer from ReadPassword

This commit is contained in:
Michael Eischer
2025-09-21 18:16:48 +02:00
parent f045297348
commit 711194276c
8 changed files with 18 additions and 23 deletions

View File

@@ -230,7 +230,7 @@ func loadPasswordFromFile(pwdFile string) (string, error) {
// ReadPassword reads the password from a password file, the environment
// variable RESTIC_PASSWORD or prompts the user. If the context is canceled,
// the function leaks the password reading goroutine.
func ReadPassword(ctx context.Context, gopts GlobalOptions, prompt string, printer progress.Printer) (string, error) {
func ReadPassword(ctx context.Context, gopts GlobalOptions, prompt string) (string, error) {
if gopts.InsecureNoPassword {
if gopts.password != "" {
return "", errors.Fatal("--insecure-no-password must not be specified together with providing a password via a cli option or environment variable")
@@ -257,13 +257,13 @@ func ReadPassword(ctx context.Context, gopts GlobalOptions, prompt string, print
// ReadPasswordTwice calls ReadPassword two times and returns an error when the
// passwords don't match. If the context is canceled, the function leaks the
// password reading goroutine.
func ReadPasswordTwice(ctx context.Context, gopts GlobalOptions, prompt1, prompt2 string, printer progress.Printer) (string, error) {
pw1, err := ReadPassword(ctx, gopts, prompt1, printer)
func ReadPasswordTwice(ctx context.Context, gopts GlobalOptions, prompt1, prompt2 string) (string, error) {
pw1, err := ReadPassword(ctx, gopts, prompt1)
if err != nil {
return "", err
}
if gopts.term.InputIsTerminal() {
pw2, err := ReadPassword(ctx, gopts, prompt2, printer)
pw2, err := ReadPassword(ctx, gopts, prompt2)
if err != nil {
return "", err
}
@@ -330,7 +330,7 @@ func OpenRepository(ctx context.Context, gopts GlobalOptions, printer progress.P
}
for ; passwordTriesLeft > 0; passwordTriesLeft-- {
gopts.password, err = ReadPassword(ctx, gopts, "enter password for repository: ", printer)
gopts.password, err = ReadPassword(ctx, gopts, "enter password for repository: ")
if ctx.Err() != nil {
return nil, ctx.Err()
}