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