Skip to content

Commit

Permalink
show.go: use named group
Browse files Browse the repository at this point in the history
  • Loading branch information
aviau committed Dec 14, 2020
1 parent ce78c92 commit 8617f23
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/gopass/internal/cli/command/show/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down

0 comments on commit 8617f23

Please sign in to comment.