From 0ebfc78b112d86153f6f1c5656bb1da08cf3e679 Mon Sep 17 00:00:00 2001 From: Dominik Schulz Date: Sun, 8 Aug 2021 15:21:00 +0200 Subject: [PATCH] Add --symbols flag to gopass pwgen (#1966) RELEASE_NOTES=[ENHANCEMENT] Add --symbols to gopass pwgen Fixes #1965 Signed-off-by: Dominik Schulz --- internal/action/pwgen/commands.go | 5 +++++ internal/action/pwgen/pwgen.go | 3 +++ 2 files changed, 8 insertions(+) diff --git a/internal/action/pwgen/commands.go b/internal/action/pwgen/commands.go index cd4e953c90..80aabdccc7 100644 --- a/internal/action/pwgen/commands.go +++ b/internal/action/pwgen/commands.go @@ -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"}, diff --git a/internal/action/pwgen/pwgen.go b/internal/action/pwgen/pwgen.go index cca315135b..2968e0f9a2 100644 --- a/internal/action/pwgen/pwgen.go +++ b/internal/action/pwgen/pwgen.go @@ -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))