pwgen/pwgen.sh

55 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
imp="import pwgenerator as g;"
function _help() {
echo "Usage: pwgen [length] [mode]"
echo ""
echo "Available modes:"
printf " %-15s\t%s\n" \
"numbers" "Generates password containing only numbers" \
"lower" "Generates password containing only lower letters" \
"upper" "Generates password containing only upper letters" \
"letters" "Generates password containing only letters" \
"letters-numbers" "Generates password containing only letters and ners" \
"full" "Generates password containing letters, numbers and symbols" \
}
case "$#" in
0)
_help
;;
1)
python -c "${imp} g.genFull($1)"
;;
2)
case "$2" in
numbers)
python -c "${imp} g.genNum($1)"
;;
lower)
python -c "${imp} g.genLetLow($1)"
;;
upper)
python -c "${imp} g.genLetUp($1)"
;;
letters)
python -c "${imp} g.genLet($1)"
;;
letters-numbers)
python -c "${imp} g.genLetNum($1)"
;;
full)
python -c "${imp} g.genFull($1)"
;;
*)
_help
;;
esac
;;
*)
_help
;;
esac