From c77f768860740edb23920018295c7d3407f69e57 Mon Sep 17 00:00:00 2001 From: "flyingscorpio@arch-desktop" Date: Fri, 10 Apr 2020 16:32:43 +0200 Subject: [PATCH] Set args to case statement --- main_install.sh | 56 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/main_install.sh b/main_install.sh index 45a209d..d3c2c24 100755 --- a/main_install.sh +++ b/main_install.sh @@ -76,18 +76,38 @@ export OS OVERWRITE='false' UPDATE='false' -if [ "$1" = '-o' ] || [ "$1" = '--overwrite' ] || [ "$2" = '-o' ] || [ "$2" = '--overwrite' ]; then - echo "${ORANGE}You agree to overwrite preexisting files!${NC}" - OVERWRITE='true' -fi -if [ "$1" = '-u' ] || [ "$1" = '--update' ] || [ "$2" = '-u' ] || [ "$2" = '--update' ]; then - echo "${ORANGE}Set to update plugins!${NC}" - UPDATE='true' -fi -if [ "$1" = '-ou' ] || [ "$1" = '-uo' ]; then - echo "${ORANGE}Both options were set.${NC}" - OVERWRITE='true' - UPDATE='true' +case "$1" in + -o | --overwrite ) + echo "${ORANGE}You agree to overwrite preexisting files!${NC}" + OVERWRITE='true' + ;; + -u | --update ) + echo "${ORANGE}Set to update plugins!${NC}" + UPDATE='true' + ;; + -ou | -uo ) + echo "${ORANGE}Both options were set.${NC}" + OVERWRITE='true' + UPDATE='true' + ;; + * ) + echo "Din't understand arguments" + exit 1 +esac +if [ "$#" -eq 2 ]; then + case "$2" in + -o | --overwrite ) + echo "${ORANGE}You agree to overwrite preexisting files!${NC}" + OVERWRITE='true' + ;; + -u | --update ) + echo "${ORANGE}Set to update plugins!${NC}" + UPDATE='true' + ;; + * ) + echo "Din't understand arguments" + exit 1 + esac fi export OVERWRITE @@ -121,7 +141,7 @@ update_vim() { # {{{ separator } # }}} -# update_vim +update_vim update_i3() { # {{{ # Update i3 configuration @@ -131,7 +151,7 @@ update_i3() { # {{{ separator } # }}} -# update_i3 +update_i3 configure_protonvpn() { # {{{ # Configure ProtonVPN @@ -143,8 +163,8 @@ configure_protonvpn() { # {{{ } # }}} # configure_protonvpn -update_bash_files() { # {{{ - # Update .bashrc +setup_bash_files() { # {{{ + # Set up .bashrc echo "Updating .bashrc..." if [ ! -L ~/.bashrc ]; then @@ -152,7 +172,7 @@ update_bash_files() { # {{{ fi separator - # Update .bash_aliases + # Set up .bash_aliases echo "Updating .bash_aliases..." if [ ! -L ~/.bash_aliases ]; then @@ -246,4 +266,4 @@ clone_projects() { # {{{ separator } # }}} -# clone_projects +clone_projects