Password generator: Difference between revisions
Content added Content deleted
Line 3,076: | Line 3,076: | ||
subset PositiveInt of Int where * > 0; |
subset PositiveInt of Int where * > 0; |
||
sub MAIN( PositiveInt : |
sub MAIN( PositiveInt :c(:$count) = 0, MinumumPasswordLength :l(:$length) = 8, Str :x(:$exclude) = '' ) |
||
{ |
{ |
||
.say for |
.say for password-characters( char-groups( $exclude.comb ) ) |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
} |
} |
||
Line 3,092: | Line 3,096: | ||
.map( * (-) @exclude ) |
.map( * (-) @exclude ) |
||
.grep( *.so ); |
.grep( *.so ); |
||
} |
|||
sub generate-passwords( UInt $count, UInt $length, @char-groups ) |
|||
{ |
|||
password-characters( @char-groups ) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
} |
} |
||
Line 3,106: | Line 3,101: | ||
{ |
{ |
||
( |@char-groups xx Inf ).map( *.pick ); |
( |@char-groups xx Inf ).map( *.pick ); |
||
} |
|||
sub USAGE() |
|||
{ |
|||
say qq:to/END/; |
|||
Specify a count: --c=1 (mandatory, at least 1), |
|||
Specify a length: --l=8 (default 8), |
|||
Specify characters to exclude: --x=... (must escape characters significant to the shell) |
|||
END |
|||
} |
} |
||
</lang> |
</lang> |