pwgen-fr/pwgen_fr/entrypoints.py

22 lines
543 B
Python

import argparse
import typing as t
from . import generate
def pwgen_fr():
choices_map: dict[str, t.Callable[[], str]] = {
"phrase4": generate.gen_phrase4,
"phrase6": generate.gen_phrase6,
"rand4": lambda: generate.gen_rand(n=4),
"rand6": lambda: generate.gen_rand(n=6),
}
parser = argparse.ArgumentParser()
parser.add_argument(
"mode", choices=choices_map.keys(), help="Select the generation procedure used"
)
args = parser.parse_args()
print(choices_map[args.mode]())