Set args to case statement
This commit is contained in:
parent
0da8c1b00b
commit
c77f768860
1 changed files with 38 additions and 18 deletions
|
@ -76,18 +76,38 @@ export OS
|
||||||
OVERWRITE='false'
|
OVERWRITE='false'
|
||||||
UPDATE='false'
|
UPDATE='false'
|
||||||
|
|
||||||
if [ "$1" = '-o' ] || [ "$1" = '--overwrite' ] || [ "$2" = '-o' ] || [ "$2" = '--overwrite' ]; then
|
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}"
|
||||||
fi
|
OVERWRITE='true'
|
||||||
if [ "$1" = '-u' ] || [ "$1" = '--update' ] || [ "$2" = '-u' ] || [ "$2" = '--update' ]; then
|
;;
|
||||||
echo "${ORANGE}Set to update plugins!${NC}"
|
-u | --update )
|
||||||
UPDATE='true'
|
echo "${ORANGE}Set to update plugins!${NC}"
|
||||||
fi
|
UPDATE='true'
|
||||||
if [ "$1" = '-ou' ] || [ "$1" = '-uo' ]; then
|
;;
|
||||||
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
|
||||||
|
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
|
fi
|
||||||
|
|
||||||
export OVERWRITE
|
export OVERWRITE
|
||||||
|
@ -121,7 +141,7 @@ update_vim() { # {{{
|
||||||
separator
|
separator
|
||||||
|
|
||||||
} # }}}
|
} # }}}
|
||||||
# update_vim
|
update_vim
|
||||||
|
|
||||||
update_i3() { # {{{
|
update_i3() { # {{{
|
||||||
# Update i3 configuration
|
# Update i3 configuration
|
||||||
|
@ -131,7 +151,7 @@ update_i3() { # {{{
|
||||||
separator
|
separator
|
||||||
|
|
||||||
} # }}}
|
} # }}}
|
||||||
# update_i3
|
update_i3
|
||||||
|
|
||||||
configure_protonvpn() { # {{{
|
configure_protonvpn() { # {{{
|
||||||
# Configure ProtonVPN
|
# Configure ProtonVPN
|
||||||
|
@ -143,8 +163,8 @@ configure_protonvpn() { # {{{
|
||||||
} # }}}
|
} # }}}
|
||||||
# configure_protonvpn
|
# configure_protonvpn
|
||||||
|
|
||||||
update_bash_files() { # {{{
|
setup_bash_files() { # {{{
|
||||||
# Update .bashrc
|
# Set up .bashrc
|
||||||
|
|
||||||
echo "Updating .bashrc..."
|
echo "Updating .bashrc..."
|
||||||
if [ ! -L ~/.bashrc ]; then
|
if [ ! -L ~/.bashrc ]; then
|
||||||
|
@ -152,7 +172,7 @@ update_bash_files() { # {{{
|
||||||
fi
|
fi
|
||||||
separator
|
separator
|
||||||
|
|
||||||
# Update .bash_aliases
|
# Set up .bash_aliases
|
||||||
|
|
||||||
echo "Updating .bash_aliases..."
|
echo "Updating .bash_aliases..."
|
||||||
if [ ! -L ~/.bash_aliases ]; then
|
if [ ! -L ~/.bash_aliases ]; then
|
||||||
|
@ -246,4 +266,4 @@ clone_projects() { # {{{
|
||||||
separator
|
separator
|
||||||
|
|
||||||
} # }}}
|
} # }}}
|
||||||
# clone_projects
|
clone_projects
|
||||||
|
|
Loading…
Add table
Reference in a new issue