Skip to content

Commit a389f4c

Browse files
authored
Add -min & -max, remove -length
It's nice to be able to specify the minimum and also the maximum length of the strings we want, so I added the -max flag.
1 parent 900c9dd commit a389f4c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

tok/main.go

+9-4
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ import (
1111
)
1212

1313
func main() {
14-
var length int
15-
flag.IntVar(&length, "length", 1, "min length of string to be output")
16-
14+
var minlength int
15+
flag.IntVar(&minlength, "min", 1, "min length of string to be output")
16+
var maxlength int
17+
flag.IntVar(&maxlength, "max", 25, "max length of string to be output")
1718
var alphaNumOnly bool
1819
flag.BoolVar(&alphaNumOnly, "alpha-num-only", false, "return only strings containing at least one letter and one number")
1920

@@ -60,7 +61,11 @@ func main() {
6061

6162
str := out.String()
6263

63-
if out.Len() < length {
64+
if out.Len() < minlength {
65+
reset()
66+
continue
67+
}
68+
if out.Len() > maxlength {
6469
reset()
6570
continue
6671
}

0 commit comments

Comments
 (0)