go-pass-gen/passgen/options.go
2021-10-20 17:30:41 +02:00

16 lines
329 B
Go

package passgen
type Options struct {
// Length of the new password
Length int
// WithNumbers is set to true if the password must contain numbers.
WithNumbers bool
}
// SetDefaults ensure options are usable to avoid certain bugs.
func (o *Options) SetDefaults() *Options {
if o.Length == 0 {
o.Length = 6
}
return o
}