From faf31fc9ee663ee2b20a88b802e1997f3ae0a2e2 Mon Sep 17 00:00:00 2001 From: Victor Westerlund Date: Thu, 7 Aug 2025 06:28:07 +0200 Subject: [PATCH] feat: add optional cli args --- install.sh | 67 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 55 insertions(+), 12 deletions(-) diff --git a/install.sh b/install.sh index 894e19b..2abfc70 100755 --- a/install.sh +++ b/install.sh @@ -1,7 +1,10 @@ #!/bin/bash -# Get the current working directory -cwd=$(pwd) +# Initialize variables +cwd="" +install="" +example="" +override="" echo_err() { echo "!! -> $1" @@ -33,7 +36,7 @@ check_sys_depend() { install_vegvisir() { if ! [ -d ".git" ] ; then - echo_err "Not in a git repository" + echo_err "Installation aborted: '$cwd' is not a git repository" exit 1 fi @@ -61,7 +64,7 @@ configure_vegvisir() { fi # A configuration file already exists - if [ -f "vegvisir/.env.ini" ] ; then + if [[ -f "vegvisir/.env.ini" && "$override" != "y" ]] ; then echo "A Vegvisir configuration file already exists at: ${cwd}/vegvisir/.env.ini" read -p "Do you want to overwrite this file? (y/n): " choice