From 8617f234103eab43ecf85d8bcb793a577779410e Mon Sep 17 00:00:00 2001 From: aviau Date: Mon, 14 Dec 2020 10:23:06 -0500 Subject: [PATCH] show.go: use named group --- cmd/gopass/internal/cli/command/show/show.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/gopass/internal/cli/command/show/show.go b/cmd/gopass/internal/cli/command/show/show.go index 2f240cd..a84f214 100644 --- a/cmd/gopass/internal/cli/command/show/show.go +++ b/cmd/gopass/internal/cli/command/show/show.go @@ -84,7 +84,12 @@ func ExecShow(cfg command.Config, args []string) error { outputPassword := password if username { if matches := usernameRegex.FindStringSubmatch(password); matches != nil { - outputPassword = matches[2] + for i, name := range usernameRegex.SubexpNames() { + if name == "username" { + outputPassword = matches[i] + break + } + } } else { return fmt.Errorf("Could not find username in the password") }