---
 src/platform/darwin.sh | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/platform/darwin.sh b/src/platform/darwin.sh
index a9d32ce..75db6a0 100644
--- a/src/platform/darwin.sh
+++ b/src/platform/darwin.sh
@@ -43,14 +43,19 @@ qrcode() {
        fi
 }
 
-GETOPT="$(PATH="/usr/local/opt/gnu-getopt/bin:/opt/local/bin:/usr/local/bin" 
command -v getopt)" || \
-GETOPT="$(brew --prefix 2>/dev/null)/opt/gnu-getopt/bin/getopt" || \
-GETOPT="$(port content getopt | grep -E '/s?bin/')"
+get_getopt() {
+       local 
GETOPT="$(PATH="/usr/local/opt/gnu-getopt/bin:/opt/local/bin:/usr/local/bin" 
command -v getopt)" || \
+       local GETOPT="$(brew --prefix 2>/dev/null)/opt/gnu-getopt/bin/getopt" 
|| \
+       local GETOPT="$(port content getopt | grep -E '/s?bin/')"
 
-if [ ! $GETOPT ]; then
-       echo "'getopt' is not installed. Please use 'brew' or 'port' to install 
it."
-       exit 1
-fi
+       if [ ! $GETOPT ]; then
+               echo "'getopt' is not installed. Please use 'brew' or 'port' to 
install it."
+               exit 1
+       fi
+
+       echo $GETOPT
+}
 
+GETOPT=$(get_getopt)
 SHRED="srm -f -z"
 BASE64="openssl base64"
-- 
2.17.1 (Apple Git-112)

_______________________________________________
Password-Store mailing list
Password-Store@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/password-store

Reply via email to