From 36dd6b5effa734f4ff77ccad3716fa25b7995d0a Mon Sep 17 00:00:00 2001 From: 3wc <3wc.git@doesthisthing.work> Date: Sat, 20 Mar 2021 23:15:07 +0200 Subject: [PATCH] Simplify `require_foo` commands --- abra | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/abra b/abra index a0921b6..9ef7453 100755 --- a/abra +++ b/abra @@ -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"