feat: POC passgen

This commit is contained in:
Roxie Gibson 2021-07-15 08:23:26 +01:00
parent 881ccfd820
commit a78bb9123a
Signed by untrusted user: roxxers
GPG Key ID: 5D0140EDEE123F4D

View File

@ -1,6 +1,11 @@
package cli package cli
import "github.com/urfave/cli/v2" import (
"fmt"
"github.com/schultz-is/passgen"
"github.com/urfave/cli/v2"
)
var appNewCommand = &cli.Command{ var appNewCommand = &cli.Command{
Name: "new", Name: "new",
@ -79,6 +84,23 @@ var appRollbackCommand = &cli.Command{
var appSecretCommand = &cli.Command{ var appSecretCommand = &cli.Command{
Name: "secret", Name: "secret",
Flags: []cli.Flag{AllFlag, PassFlag}, Flags: []cli.Flag{AllFlag, PassFlag},
Action: func(c *cli.Context) error {
passwords, err := passgen.GeneratePassphrases(
1,
passgen.PassphraseWordCountDefault,
rune('-'),
passgen.PassphraseCasingDefault,
passgen.WordListDefault,
)
if err != nil {
panic(err)
}
for _, password := range passwords {
fmt.Println(password)
}
return nil
},
} }
var AppCommand = &cli.Command{ var AppCommand = &cli.Command{