add --no-modify-config flag to install.sh
parent
7ffb9e2579
commit
00d17ff16a
|
|
@ -9,6 +9,7 @@ function show_usage() {
|
||||||
echo "--help (-h): Display this help message"
|
echo "--help (-h): Display this help message"
|
||||||
echo "--silent (-s): Install default settings without prompting for input";
|
echo "--silent (-s): Install default settings without prompting for input";
|
||||||
echo "--interactive (-i): Interactively choose plugins"
|
echo "--interactive (-i): Interactively choose plugins"
|
||||||
|
echo "--no-modify-config (-n): Do not modify existing config file"
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -67,17 +68,19 @@ for param in "$@"; do
|
||||||
"--help") set -- "$@" "-h" ;;
|
"--help") set -- "$@" "-h" ;;
|
||||||
"--silent") set -- "$@" "-s" ;;
|
"--silent") set -- "$@" "-s" ;;
|
||||||
"--interactive") set -- "$@" "-i" ;;
|
"--interactive") set -- "$@" "-i" ;;
|
||||||
|
"--no-modify-config") set -- "$@" "-n" ;;
|
||||||
*) set -- "$@" "$param"
|
*) set -- "$@" "$param"
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
OPTIND=1
|
OPTIND=1
|
||||||
while getopts "hsi" opt
|
while getopts "hsin" opt
|
||||||
do
|
do
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
"h") show_usage; exit 0 ;;
|
"h") show_usage; exit 0 ;;
|
||||||
"s") silent=true ;;
|
"s") silent=true ;;
|
||||||
"i") interactive=true ;;
|
"i") interactive=true ;;
|
||||||
|
"n") no_modify_config=true ;;
|
||||||
"?") show_usage >&2; exit 1 ;;
|
"?") show_usage >&2; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
@ -101,6 +104,7 @@ esac
|
||||||
|
|
||||||
BACKUP_FILE=$CONFIG_FILE.bak
|
BACKUP_FILE=$CONFIG_FILE.bak
|
||||||
echo "Installing bash-it"
|
echo "Installing bash-it"
|
||||||
|
if ! [[ $silent ]] && ! [[ $no_modify_config ]]; then
|
||||||
if [ -e "$HOME/$BACKUP_FILE" ]; then
|
if [ -e "$HOME/$BACKUP_FILE" ]; then
|
||||||
echo -e "\033[0;33mBackup file already exists. Make sure to backup your .bashrc before running this installation.\033[0m" >&2
|
echo -e "\033[0;33mBackup file already exists. Make sure to backup your .bashrc before running this installation.\033[0m" >&2
|
||||||
while ! [ $silent ]; do
|
while ! [ $silent ]; do
|
||||||
|
|
@ -141,8 +145,7 @@ while ! [ $silent ]; do
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
elif [[ $silent ]] && ! [[ $no_modify_config ]]; then
|
||||||
if [ $silent ]; then
|
|
||||||
# backup/new by default
|
# backup/new by default
|
||||||
backup_new
|
backup_new
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue