Change arg handling a bit

This commit is contained in:
flyingscorpio@pinebook-pro 2020-04-11 09:46:17 +02:00
parent 17a891cd5f
commit d6a125a1d9

View file

@ -79,24 +79,26 @@ export OS
OVERWRITE='false' OVERWRITE='false'
UPDATE='false' UPDATE='false'
case "$1" in if [ "$#" -ge 1 ]; then
-o | --overwrite ) case "$1" in
echo "${ORANGE}You agree to overwrite preexisting files!${NC}" -o | --overwrite )
OVERWRITE='true' echo "${ORANGE}You agree to overwrite preexisting files!${NC}"
;; OVERWRITE='true'
-u | --update ) ;;
echo "${ORANGE}Set to update plugins!${NC}" -u | --update )
UPDATE='true' echo "${ORANGE}Set to update plugins!${NC}"
;; UPDATE='true'
-ou | -uo ) ;;
echo "${ORANGE}Both options were set.${NC}" -ou | -uo )
OVERWRITE='true' echo "${ORANGE}Both options were set.${NC}"
UPDATE='true' OVERWRITE='true'
;; UPDATE='true'
* ) ;;
echo "Din't understand arguments" * )
exit 1 echo "Din't understand arguments"
esac exit 1
esac
fi
if [ "$#" -eq 2 ]; then if [ "$#" -eq 2 ]; then
case "$2" in case "$2" in
-o | --overwrite ) -o | --overwrite )
@ -154,7 +156,7 @@ setup_sddm() { # {{{
separator separator
} # }}} } # }}}
setup_sddm # setup_sddm
update_i3() { # {{{ update_i3() { # {{{
# Update i3 configuration # Update i3 configuration
@ -164,7 +166,7 @@ update_i3() { # {{{
separator separator
} # }}} } # }}}
update_i3 # update_i3
configure_protonvpn() { # {{{ configure_protonvpn() { # {{{
# Configure ProtonVPN # Configure ProtonVPN
@ -209,7 +211,7 @@ configure_git() { # {{{
separator separator
} # }}} } # }}}
configure_git # configure_git
install_rust() { # {{{ install_rust() { # {{{
# Install Rust # Install Rust
@ -279,4 +281,4 @@ clone_projects() { # {{{
separator separator
} # }}} } # }}}
# clone_projects clone_projects