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'
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue