Simplify require_foo commands

This commit is contained in:
3wc 2021-03-20 23:15:07 +02:00
parent 2f1f51bad1
commit 36dd6b5eff

16
abra
View File

@ -401,16 +401,18 @@ require_bash_4() {
fi
}
require_pwqgen() {
if ! type pwqgen > /dev/null 2>&1; then
error "pwqgen program is not installed"
require_binary() {
if ! type "$1" > /dev/null 2>&1; then
error "'$1' program is not installed"
fi
}
require_pwqgen() {
require_binary pwqgen
}
require_wget() {
if ! type wget > /dev/null 2>&1; then
error "wget program is not installed"
fi
require_binary wget
}
require_abra_dir() {
@ -1397,7 +1399,7 @@ sub_app_secret_generate(){
PWGEN="${abra__cmd_:-pwqgen}"
fi
echo "SECRET: $SECRET, VERSION $VERSION, PW $PW, ALL $abra___all"
debug "SECRET: $SECRET, VERSION $VERSION, PW $PWGEN, ALL $abra___all"
if [ -z "$SECRET" ] || [ -z "$VERSION" ] && [ "$abra___all" == "false" ]; then
error "Required arguments missing"