Skip to content

Commit

Permalink
Print informative message when password is copied
Browse files Browse the repository at this point in the history
  • Loading branch information
Bollos00 committed Dec 14, 2021
1 parent e00b49b commit 5ba1fca
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/passwgen/passwgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,11 @@ func (psg PasswGen) Generate() string {
}

if psg.CopyClipboard {
clipboard.WriteAll(string(password))
if err := clipboard.WriteAll(string(password)); err == nil {
fmt.Printf("Successfully copied the password to the clipboard.\n\n")
} else {
fmt.Printf("Error when trying to copy the password to the clipboard\n%v", err.Error())
}
} else {
fmt.Printf("Generated password:\n%v\n", string(password))
}
Expand Down

0 comments on commit 5ba1fca

Please sign in to comment.