install: lint
parent
a76731dad3
commit
f7bc3324fa
28
install.sh
28
install.sh
|
|
@ -83,8 +83,8 @@ function _bash-it_check_for_backup() {
|
||||||
fi
|
fi
|
||||||
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
|
||||||
|
|
||||||
if ! [[ $overwrite_backup ]]; then
|
if [[ -z "${overwrite_backup}" ]]; then
|
||||||
while ! [[ $silent ]]; do
|
while [[ -z "${silent}" ]]; do
|
||||||
read -e -n 1 -r -p "Would you like to overwrite the existing backup? This will delete your existing backup file ($HOME/$BACKUP_FILE) [y/N] " RESP
|
read -e -n 1 -r -p "Would you like to overwrite the existing backup? This will delete your existing backup file ($HOME/$BACKUP_FILE) [y/N] " RESP
|
||||||
case $RESP in
|
case $RESP in
|
||||||
[yY])
|
[yY])
|
||||||
|
|
@ -100,9 +100,9 @@ function _bash-it_check_for_backup() {
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
if ! [[ $overwrite_backup ]]; then
|
if [[ -z "${overwrite_backup}" ]]; then
|
||||||
echo -e "\033[91mInstallation aborted. Please come back soon!\033[m"
|
echo -e "\033[91mInstallation aborted. Please come back soon!\033[m"
|
||||||
if [[ $silent ]]; then
|
if [[ -n "${silent}" ]]; then
|
||||||
echo -e "\033[91mUse \"-f\" flag to force overwrite of backup.\033[m"
|
echo -e "\033[91mUse \"-f\" flag to force overwrite of backup.\033[m"
|
||||||
fi
|
fi
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -114,8 +114,8 @@ function _bash-it_check_for_backup() {
|
||||||
function _bash-it_modify_config_files() {
|
function _bash-it_modify_config_files() {
|
||||||
_bash-it_check_for_backup
|
_bash-it_check_for_backup
|
||||||
|
|
||||||
if ! [[ $silent ]]; then
|
if [[ -z "${silent}" ]]; then
|
||||||
while ! [[ $append_to_config ]]; do
|
while [[ -z "${append_to_config}" ]]; do
|
||||||
read -e -n 1 -r -p "Would you like to keep your $CONFIG_FILE and append bash-it templates at the end? [y/N] " choice
|
read -e -n 1 -r -p "Would you like to keep your $CONFIG_FILE and append bash-it templates at the end? [y/N] " choice
|
||||||
case $choice in
|
case $choice in
|
||||||
[yY])
|
[yY])
|
||||||
|
|
@ -131,7 +131,7 @@ function _bash-it_modify_config_files() {
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
if [[ $append_to_config ]]; then
|
if [[ -n "${append_to_config}" ]]; then
|
||||||
# backup/append
|
# backup/append
|
||||||
_bash-it_backup_append
|
_bash-it_backup_append
|
||||||
else
|
else
|
||||||
|
|
@ -174,12 +174,12 @@ done
|
||||||
|
|
||||||
shift $((OPTIND - 1))
|
shift $((OPTIND - 1))
|
||||||
|
|
||||||
if [[ $silent ]] && [[ $interactive ]]; then
|
if [[ -n "${silent}" && -n "${interactive}" ]]; then
|
||||||
echo -e "\033[91mOptions --silent and --interactive are mutually exclusive. Please choose one or the other.\033[m"
|
echo -e "\033[91mOptions --silent and --interactive are mutually exclusive. Please choose one or the other.\033[m"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $no_modify_config ]] && [[ $append_to_config ]]; then
|
if [[ -n "${no_modify_config}" && -n "${append_to_config}" ]]; then
|
||||||
echo -e "\033[91mOptions --no-modify-config and --append-to-config are mutually exclusive. Please choose one or the other.\033[m"
|
echo -e "\033[91mOptions --no-modify-config and --append-to-config are mutually exclusive. Please choose one or the other.\033[m"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
@ -197,7 +197,7 @@ esac
|
||||||
|
|
||||||
BACKUP_FILE=$CONFIG_FILE.bak
|
BACKUP_FILE=$CONFIG_FILE.bak
|
||||||
echo "Installing bash-it"
|
echo "Installing bash-it"
|
||||||
if ! [[ $no_modify_config ]]; then
|
if [[ -z "${no_modify_config}" ]]; then
|
||||||
_bash-it_modify_config_files
|
_bash-it_modify_config_files
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -212,10 +212,10 @@ cite _about _param _example _group _author _version
|
||||||
# shellcheck source=./lib/helpers.bash
|
# shellcheck source=./lib/helpers.bash
|
||||||
source "$BASH_IT/lib/helpers.bash"
|
source "$BASH_IT/lib/helpers.bash"
|
||||||
|
|
||||||
if [[ $interactive ]] && ! [[ $silent ]]; then
|
if [[ -n $interactive && -z "${silent}" ]]; then
|
||||||
for type in "aliases" "plugins" "completion"; do
|
for type in "aliases" "plugins" "completion"; do
|
||||||
echo -e "\033[0;32mEnabling $type\033[0m"
|
echo -e "\033[0;32mEnabling ${type}\033[0m"
|
||||||
_bash-it_load_some $type
|
_bash-it_load_some "$type"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
echo ""
|
echo ""
|
||||||
|
|
@ -230,7 +230,7 @@ fi
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "\033[0;32mInstallation finished successfully! Enjoy bash-it!\033[0m"
|
echo -e "\033[0;32mInstallation finished successfully! Enjoy bash-it!\033[0m"
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
echo -e "\033[0;32mTo start using it, open a new tab or 'source "$HOME/$CONFIG_FILE"'.\033[0m"
|
echo -e "\033[0;32mTo start using it, open a new tab or 'source "~/$CONFIG_FILE"'.\033[0m"
|
||||||
echo ""
|
echo ""
|
||||||
echo "To show the available aliases/completions/plugins, type one of the following:"
|
echo "To show the available aliases/completions/plugins, type one of the following:"
|
||||||
echo " bash-it show aliases"
|
echo " bash-it show aliases"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue