Use pwgen/pwqgen if installed

Closes #197.
This commit is contained in:
decentral1se 2021-07-05 23:55:23 +02:00
parent cc4efe69bf
commit aa81d26d08
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with 10 additions and 0 deletions

10
abra
View File

@ -656,10 +656,20 @@ checkout_main_or_master() {
}
pwgen_native() {
if type pwgen > /dev/null 2>&1; then
pwgen -s "$length" 1
return
fi
tr -dc 'a-zA-Z0-9' < /dev/urandom | head -c "$1"
}
pwqgen_native() {
if type pwqgen > /dev/null 2>&1; then
pwqgen
return
fi
shuf -n 3 /usr/share/dict/words | tr -dc 'a-zA-Z0-9' | tr -d '\n'
}