Skip to content

Commit

Permalink
Add --symbols flag to gopass pwgen (#1966)
Browse files Browse the repository at this point in the history
RELEASE_NOTES=[ENHANCEMENT] Add --symbols to gopass pwgen

Fixes #1965

Signed-off-by: Dominik Schulz <dominik.schulz@gauner.org>
  • Loading branch information
dominikschulz authored Aug 8, 2021
1 parent 1131dbf commit 0ebfc78
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/action/pwgen/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ func GetCommands() []*cli.Command {
Aliases: []string{"B"},
Usage: "Do not include characters that could be easily confused with each other, like '1' and 'l' or '0' and 'O'",
},
&cli.BoolFlag{
Name: "symbols",
Aliases: []string{"y"},
Usage: "Include at least one symbol in the password.",
},
&cli.BoolFlag{
Name: "one-per-line",
Aliases: []string{"1"},
Expand Down
3 changes: 3 additions & 0 deletions internal/action/pwgen/pwgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ func pwGen(c *cli.Context, pwLen, pwNum int) error {
if c.Bool("ambiguous") {
charset = pwgen.Prune(charset, pwgen.Ambiq)
}
if c.Bool("symbols") {
charset += pwgen.Syms
}
for i := 0; i < pwNum; i++ {
for j := 0; j < perLine; j++ {
fmt.Print(pwgen.GeneratePasswordCharset(pwLen, charset))
Expand Down

0 comments on commit 0ebfc78

Please sign in to comment.