Merge affbce6de1 into e38696a0ac
commit
a8c073fa3b
|
|
@ -20,6 +20,7 @@ aliases/
|
||||||
docs/
|
docs/
|
||||||
hooks/
|
hooks/
|
||||||
scripts/
|
scripts/
|
||||||
|
template/
|
||||||
|
|
||||||
# root files
|
# root files
|
||||||
#
|
#
|
||||||
|
|
@ -28,6 +29,7 @@ bash_it.sh
|
||||||
clean_files.txt
|
clean_files.txt
|
||||||
install.sh
|
install.sh
|
||||||
lint_clean_files.sh
|
lint_clean_files.sh
|
||||||
|
uninstall.sh
|
||||||
|
|
||||||
# completions
|
# completions
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ Installation
|
||||||
|
|
||||||
#. Check out a clone of this repo to a location of your choice, such as
|
#. Check out a clone of this repo to a location of your choice, such as
|
||||||
``git clone --depth=1 https://github.com/Bash-it/bash-it.git ~/.bash_it``
|
``git clone --depth=1 https://github.com/Bash-it/bash-it.git ~/.bash_it``
|
||||||
#. Run ``~/.bash_it/install.sh`` (it automatically backs up your ``~/.bash_profile`` or ``~/.bashrc``\ , depending on your OS)
|
#. Run ``~/.bash_it/install.sh`` (it automatically backs up your ``~/.bashrc``\ )
|
||||||
#. Edit your modified config (\ ``~/.bash_profile`` or ``~/.bashrc``\ ) file in order to customize Bash-it.
|
#. Edit your modified config (\ ``~/.bashrc``\ ) file in order to customize Bash-it.
|
||||||
#. Check out available aliases, completions, and plugins and enable the ones you want to use (see the next section for more details).
|
#. Check out available aliases, completions, and plugins and enable the ones you want to use (see the next section for more details).
|
||||||
|
|
||||||
Install Options
|
Install Options
|
||||||
|
|
@ -18,7 +18,7 @@ The install script can take the following options:
|
||||||
|
|
||||||
* ``--interactive``\ : Asks the user which aliases, completions and plugins to enable.
|
* ``--interactive``\ : Asks the user which aliases, completions and plugins to enable.
|
||||||
* ``--silent``\ : Ask nothing and install using default settings.
|
* ``--silent``\ : Ask nothing and install using default settings.
|
||||||
* ``--no-modify-config``\ : Do not modify the existing config file (\ ``~/.bash_profile`` or ``~/.bashrc``\ ).
|
* ``--no-modify-config``\ : Do not modify the existing config file (\ ``~/.bashrc``\ ).
|
||||||
* ``--append-to-config``\ : Back up existing config file and append bash-it templates at the end.
|
* ``--append-to-config``\ : Back up existing config file and append bash-it templates at the end.
|
||||||
|
|
||||||
When run without the ``--interactive`` switch, Bash-it only enables a sane default set of functionality to keep your shell clean and to avoid issues with missing dependencies.
|
When run without the ``--interactive`` switch, Bash-it only enables a sane default set of functionality to keep your shell clean and to avoid issues with missing dependencies.
|
||||||
|
|
@ -28,16 +28,14 @@ When you run without the ``--no-modify-config`` switch, the Bash-it installer au
|
||||||
Use the ``--no-modify-config`` switch to avoid unwanted modifications, e.g. if your Bash config file already contains the code that loads Bash-it.
|
Use the ``--no-modify-config`` switch to avoid unwanted modifications, e.g. if your Bash config file already contains the code that loads Bash-it.
|
||||||
|
|
||||||
**NOTE**\ : Keep in mind how Bash loads its configuration files,
|
**NOTE**\ : Keep in mind how Bash loads its configuration files,
|
||||||
``.bash_profile`` for login shells (and in macOS in terminal emulators like `Terminal.app <http://www.apple.com/osx/apps/>`_ or
|
``.bash_profile`` for login shells and ``.bashrc`` for interactive shells, to ensure that Bash-it is loaded correctly.
|
||||||
`iTerm2 <https://www.iterm2.com/>`_\ ) and ``.bashrc`` for interactive shells (default mode in most of the GNU/Linux terminal emulators),
|
|
||||||
to ensure that Bash-it is loaded correctly.
|
|
||||||
A good "practice" is sourcing ``.bashrc`` into ``.bash_profile`` to keep things working in all the scenarios.
|
A good "practice" is sourcing ``.bashrc`` into ``.bash_profile`` to keep things working in all the scenarios.
|
||||||
To achieve this, you can add this snippet in your ``.bash_profile``\ :
|
To achieve this, you can add this snippet in your ``.bash_profile``\ :
|
||||||
|
|
||||||
.. code-block::
|
.. code-block::
|
||||||
|
|
||||||
if [ -f ~/.bashrc ]; then
|
if [[ $- == *"i"* && -f ~/.bashrc ]]; then
|
||||||
. ~/.bashrc
|
source ~/.bashrc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
Refer to the official `Bash documentation <https://www.gnu.org/software/bash/manual/bashref.html#Bash-Startup-Files>`_ to get more info.
|
Refer to the official `Bash documentation <https://www.gnu.org/software/bash/manual/bashref.html#Bash-Startup-Files>`_ to get more info.
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ Automatically via terminal
|
||||||
|
|
||||||
|
|
||||||
#. You can install the theme automatically using the ``sed`` command from your Linux or OSX Terminal.
|
#. You can install the theme automatically using the ``sed`` command from your Linux or OSX Terminal.
|
||||||
#. On macOS, the ~/.bash_profile is used, not the ~/.bashrc.
|
|
||||||
#. For installation on windows you should use `\ ``Git-Bash`` <https://git-for-windows.github.io/>`_ or make sure the terminal emulator you use (ej: cygwin, mintty, etc) has the ``sed`` command installed.
|
#. For installation on windows you should use `\ ``Git-Bash`` <https://git-for-windows.github.io/>`_ or make sure the terminal emulator you use (ej: cygwin, mintty, etc) has the ``sed`` command installed.
|
||||||
|
|
||||||
Command to execute For Windows and Linux:
|
Command to execute For Windows and Linux:
|
||||||
|
|
@ -51,7 +50,7 @@ Command to execute for macOS:
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
# Set the "atomic" theme replacing the theme you are using of bash-it
|
# Set the "atomic" theme replacing the theme you are using of bash-it
|
||||||
sed -i '' 's/'"$BASH_IT_THEME"'/atomic/g' ~/.bash_profile
|
sed -i '' 's/'"$BASH_IT_THEME"'/atomic/g' ~/.bashrc
|
||||||
|
|
||||||
Features
|
Features
|
||||||
--------
|
--------
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ all powerline themes.
|
||||||
|
|
||||||
**IMPORTANT:** This theme requires that `a font with the Powerline symbols <https://github.com/powerline/fonts>`_ needs to be used in your terminal emulator, otherwise the prompt won't be displayed correctly, i.e. some of the additional icons and characters will be missing. Please follow your operating system's instructions to install one of the fonts from the above link and select it in your terminal emulator.
|
**IMPORTANT:** This theme requires that `a font with the Powerline symbols <https://github.com/powerline/fonts>`_ needs to be used in your terminal emulator, otherwise the prompt won't be displayed correctly, i.e. some of the additional icons and characters will be missing. Please follow your operating system's instructions to install one of the fonts from the above link and select it in your terminal emulator.
|
||||||
|
|
||||||
**NOTICE:** The default behavior of this theme assumes that you have sudo privileges on your workstation. If that is not the case (e.g. if you are running on a corporate network where ``sudo`` usage is tracked), you can set the flag 'export THEME_CHECK_SUDO=false' in your ``~/.bashrc`` or ``~/.bash_profile`` to disable the Powerline theme's ``sudo`` check. This will apply to all ``powerline*`` themes.
|
**NOTICE:** The default behavior of this theme assumes that you have sudo privileges on your workstation. If that is not the case (e.g. if you are running on a corporate network where ``sudo`` usage is tracked), you can set the flag 'export THEME_CHECK_SUDO=false' in your ``~/.bashrc`` to disable the Powerline theme's ``sudo`` check. This will apply to all ``powerline*`` themes.
|
||||||
|
|
||||||
Provided Information
|
Provided Information
|
||||||
--------------------
|
--------------------
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ To get the length of the left and right segments right, a *padding* value is use
|
||||||
In most cases, the default value (\ *2*\ ) works fine, but on some operating systems, this needs to be adjusted.
|
In most cases, the default value (\ *2*\ ) works fine, but on some operating systems, this needs to be adjusted.
|
||||||
One example is *macOS High Sierra*\ , where the default padding causes the right segment to extend to the next line.
|
One example is *macOS High Sierra*\ , where the default padding causes the right segment to extend to the next line.
|
||||||
On macOS High Sierra, the padding value needs to be changed to *3* to make the theme look right.
|
On macOS High Sierra, the padding value needs to be changed to *3* to make the theme look right.
|
||||||
This can be done by setting the ``POWERLINE_PADDING`` variable before Bash-it is loaded, e.g. in your ``~/.bash_profile`` or ``~/.bashrc`` file:
|
This can be done by setting the ``POWERLINE_PADDING`` variable before Bash-it is loaded, e.g. in your ``~/.bashrc`` file:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ Turn version control checking off to prevent slow directory navigation within la
|
||||||
Controlling Flags
|
Controlling Flags
|
||||||
^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Bash-it provides a flag (\ ``SCM_CHECK``\ ) within the ``~/.bash_profile`` file that turns off/on version control information checking and display within all themes.
|
Bash-it provides a flag (\ ``SCM_CHECK``\ ) within the ``~/.bashrc`` file that turns off/on version control information checking and display within all themes.
|
||||||
Version control checking is on by default unless explicitly turned off.
|
Version control checking is on by default unless explicitly turned off.
|
||||||
|
|
||||||
Set ``SCM_CHECK`` to 'false' to **turn off** version control checks for all themes:
|
Set ``SCM_CHECK`` to 'false' to **turn off** version control checks for all themes:
|
||||||
|
|
|
||||||
143
install.sh
143
install.sh
|
|
@ -2,7 +2,7 @@
|
||||||
# bash-it installer
|
# bash-it installer
|
||||||
|
|
||||||
# Show how to use this installer
|
# Show how to use this installer
|
||||||
function _bash-it_show_usage() {
|
function _bash-it-install-help() {
|
||||||
echo -e "\n$0 : Install bash-it"
|
echo -e "\n$0 : Install bash-it"
|
||||||
echo -e "Usage:\n$0 [arguments] \n"
|
echo -e "Usage:\n$0 [arguments] \n"
|
||||||
echo "Arguments:"
|
echo "Arguments:"
|
||||||
|
|
@ -14,41 +14,27 @@ function _bash-it_show_usage() {
|
||||||
echo "--overwrite-backup (-f): Overwrite existing backup"
|
echo "--overwrite-backup (-f): Overwrite existing backup"
|
||||||
}
|
}
|
||||||
|
|
||||||
# enable a thing
|
|
||||||
function _bash-it_load_one() {
|
|
||||||
file_type=$1
|
|
||||||
file_to_enable=$2
|
|
||||||
mkdir -p "$BASH_IT/${file_type}/enabled"
|
|
||||||
|
|
||||||
dest="${BASH_IT}/${file_type}/enabled/${file_to_enable}"
|
|
||||||
if [ ! -e "${dest}" ]; then
|
|
||||||
ln -sf "../available/${file_to_enable}" "${dest}"
|
|
||||||
else
|
|
||||||
echo "File ${dest} exists, skipping"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Interactively enable several things
|
# Interactively enable several things
|
||||||
function _bash-it_load_some() {
|
function _bash-it-install-enable() {
|
||||||
|
local file_type single_type enable_func file_name just_the_name RESP
|
||||||
file_type=$1
|
file_type=$1
|
||||||
single_type=$(echo "$file_type" | sed -e "s/aliases$/alias/g" | sed -e "s/plugins$/plugin/g")
|
single_type=$(echo "$file_type" | sed -e "s/aliases$/alias/g" | sed -e "s/plugins$/plugin/g")
|
||||||
enable_func="_enable-$single_type"
|
enable_func="_enable-$single_type"
|
||||||
[ -d "$BASH_IT/$file_type/enabled" ] || mkdir "$BASH_IT/$file_type/enabled"
|
for path in "${BASH_IT?}/${file_type}/available/"[^_]*; do
|
||||||
for path in "$BASH_IT/${file_type}/available/"[^_]*; do
|
file_name="${path##*/}"
|
||||||
file_name=$(basename "$path")
|
|
||||||
while true; do
|
while true; do
|
||||||
just_the_name="${file_name%%.*}"
|
just_the_name="${file_name%".${file_type}.bash"}"
|
||||||
read -r -e -n 1 -p "Would you like to enable the $just_the_name $file_type? [y/N] " RESP
|
read -r -e -n 1 -p "Would you like to enable the $just_the_name $file_type? [y/N] " RESP
|
||||||
case $RESP in
|
case $RESP in
|
||||||
[yY])
|
[yY])
|
||||||
$enable_func "$just_the_name"
|
"$enable_func" "$just_the_name"
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
[nN] | "")
|
[nN] | "")
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo -e "\033[91mPlease choose y or n.\033[m"
|
echo -e "${echo_orange:-}Please choose y or n.${echo_normal:-}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
@ -56,35 +42,35 @@ function _bash-it_load_some() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Back up existing profile
|
# Back up existing profile
|
||||||
function _bash-it_backup() {
|
function _bash-it-install-backup-config() {
|
||||||
test -w "$HOME/$CONFIG_FILE" \
|
test -w "${HOME?}/${CONFIG_FILE?}" \
|
||||||
&& cp -aL "$HOME/$CONFIG_FILE" "$HOME/$CONFIG_FILE.bak" \
|
&& cp -aL "${HOME?}/${CONFIG_FILE?}" "${HOME?}/${CONFIG_FILE?}.bak" \
|
||||||
&& echo -e "\033[0;32mYour original $CONFIG_FILE has been backed up to $CONFIG_FILE.bak\033[0m"
|
&& echo -e "${echo_green:-}Your original ${CONFIG_FILE?} has been backed up to ${CONFIG_FILE?}.bak${echo_normal:-}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Back up existing profile and create new one for bash-it
|
# Back up existing profile and create new one for bash-it
|
||||||
function _bash-it_backup_new() {
|
function _bash-it-install-backup-new() {
|
||||||
_bash-it_backup
|
_bash-it-install-backup-config
|
||||||
sed "s|{{BASH_IT}}|$BASH_IT|" "$BASH_IT/template/bash_profile.template.bash" > "$HOME/$CONFIG_FILE"
|
sed "s|{{BASH_IT}}|${BASH_IT?}|" "${BASH_IT?}/template/bashrc.template.bash" > "${HOME?}/${CONFIG_FILE?}"
|
||||||
echo -e "\033[0;32mCopied the template $CONFIG_FILE into ~/$CONFIG_FILE, edit this file to customize bash-it\033[0m"
|
echo -e "${echo_green:-}Copied the template ${CONFIG_FILE?} into ~/${CONFIG_FILE?}, edit this file to customize bash-it${echo_normal:-}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Back up existing profile and append bash-it templates at the end
|
# Back up existing profile and append bash-it templates at the end
|
||||||
function _bash-it_backup_append() {
|
function _bash-it-install-backup-append() {
|
||||||
_bash-it_backup
|
_bash-it-install-backup-config
|
||||||
(sed "s|{{BASH_IT}}|$BASH_IT|" "$BASH_IT/template/bash_profile.template.bash" | tail -n +2) >> "$HOME/$CONFIG_FILE"
|
(sed "s|{{BASH_IT}}|${BASH_IT?}|" "${BASH_IT?}/template/bashrc.template.bash" | tail -n +2) >> "${HOME?}/${CONFIG_FILE?}"
|
||||||
echo -e "\033[0;32mBash-it template has been added to your $CONFIG_FILE\033[0m"
|
echo -e "${echo_green:-}Bash-it template has been added to your ${CONFIG_FILE?}${echo_normal:-}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function _bash-it_check_for_backup() {
|
function _bash-it-install-backup-check() {
|
||||||
if ! [[ -e "$HOME/$BACKUP_FILE" ]]; then
|
if ! [[ -e "${HOME?}/$BACKUP_FILE" ]]; then
|
||||||
return
|
return
|
||||||
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 "${echo_yellow:-}Backup file already exists. Make sure to backup your .bashrc before running this installation.${echo_normal:-}" >&2
|
||||||
|
|
||||||
if [[ -z "${overwrite_backup}" ]]; then
|
if [[ -z "${overwrite_backup}" ]]; then
|
||||||
while [[ -z "${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])
|
||||||
overwrite_backup=true
|
overwrite_backup=true
|
||||||
|
|
@ -94,28 +80,28 @@ function _bash-it_check_for_backup() {
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo -e "\033[91mPlease choose y or n.\033[m"
|
echo -e "${echo_orange:-}Please choose y or n.${echo_normal:-}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
if [[ -z "${overwrite_backup}" ]]; then
|
if [[ -z "${overwrite_backup}" ]]; then
|
||||||
echo -e "\033[91mInstallation aborted. Please come back soon!\033[m"
|
echo -e "${echo_orange:-}Installation aborted. Please come back soon!${echo_normal:-}"
|
||||||
if [[ -n "${silent}" ]]; then
|
if [[ -n "${silent}" ]]; then
|
||||||
echo -e "\033[91mUse \"-f\" flag to force overwrite of backup.\033[m"
|
echo -e "${echo_orange:-}Use \"-f\" flag to force overwrite of backup.${echo_normal:-}"
|
||||||
fi
|
fi
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo -e "\033[0;32mOverwriting backup...\033[m"
|
echo -e "${echo_green:-}Overwriting backup...${echo_normal:-}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function _bash-it_modify_config_files() {
|
function _bash-it-install-modify-config() {
|
||||||
_bash-it_check_for_backup
|
_bash-it-install-backup-check
|
||||||
|
|
||||||
if [[ -z "${silent}" ]]; then
|
if [[ -z "${silent}" ]]; then
|
||||||
while [[ -z "${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])
|
||||||
append_to_config=true
|
append_to_config=true
|
||||||
|
|
@ -125,17 +111,28 @@ function _bash-it_modify_config_files() {
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo -e "\033[91mPlease choose y or n.\033[m"
|
echo -e "${echo_orange:-}Please choose y or n.${echo_normal:-}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
if [[ -n "${append_to_config}" ]]; then
|
if [[ -n "${append_to_config:-}" ]]; then
|
||||||
# backup/append
|
# backup/append
|
||||||
_bash-it_backup_append
|
_bash-it-install-backup-append
|
||||||
else
|
else
|
||||||
# backup/new by default
|
# backup/new by default
|
||||||
_bash-it_backup_new
|
_bash-it-install-backup-new
|
||||||
|
fi
|
||||||
|
_bash-it-install-modify-profile
|
||||||
|
}
|
||||||
|
|
||||||
|
function _bash-it-install-modify-profile() {
|
||||||
|
local choice profile_string=$'if [[ $- == *i* && -s ~/.bashrc ]]; then\n\tsource ~/.bashrc\nfi'
|
||||||
|
if [[ ! -f ~/.bash_profile ]]; then
|
||||||
|
printf '%s\n' "${profile_string}" > ~/.bash_profile
|
||||||
|
else
|
||||||
|
printf "${echo_yellow:-}%s${echo_normal:-}" "You may need to update your ~/.bash_profile (or ~/.profile) to source your ~/.bashrc:"
|
||||||
|
printf '%s\n' "${profile_string}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -156,7 +153,7 @@ OPTIND=1
|
||||||
while getopts "hsinaf" opt; do
|
while getopts "hsinaf" opt; do
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
"h")
|
"h")
|
||||||
_bash-it_show_usage
|
_bash-it-install-help
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
"s") silent=true ;;
|
"s") silent=true ;;
|
||||||
|
|
@ -165,7 +162,7 @@ while getopts "hsinaf" opt; do
|
||||||
"a") append_to_config=true ;;
|
"a") append_to_config=true ;;
|
||||||
"f") overwrite_backup=true ;;
|
"f") overwrite_backup=true ;;
|
||||||
"?")
|
"?")
|
||||||
_bash-it_show_usage >&2
|
_bash-it-install-help >&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
@ -174,49 +171,44 @@ done
|
||||||
shift $((OPTIND - 1))
|
shift $((OPTIND - 1))
|
||||||
|
|
||||||
if [[ -n "${silent}" && -n "${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 "${echo_orange:-}Options --silent and --interactive are mutually exclusive. Please choose one or the other.${echo_normal:-}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "${no_modify_config}" && -n "${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 "${echo_orange:-}Options --no-modify-config and --append-to-config are mutually exclusive. Please choose one or the other.${echo_normal:-}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BASH_IT="$(cd "${BASH_SOURCE%/*}" && pwd)"
|
BASH_IT="$(cd "${BASH_SOURCE%/*}" && pwd)"
|
||||||
|
|
||||||
case $OSTYPE in
|
CONFIG_FILE=".bashrc"
|
||||||
darwin*)
|
|
||||||
CONFIG_FILE=.bash_profile
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
CONFIG_FILE=.bashrc
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
BACKUP_FILE=$CONFIG_FILE.bak
|
BACKUP_FILE="${CONFIG_FILE?}.bak"
|
||||||
echo "Installing bash-it"
|
echo "Installing bash-it"
|
||||||
if [[ -z "${no_modify_config}" ]]; then
|
if [[ -z "${no_modify_config}" ]]; then
|
||||||
_bash-it_modify_config_files
|
_bash-it-install-modify-config
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Disable auto-reload in case its enabled
|
# Disable auto-reload in case its enabled
|
||||||
export BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE=''
|
export BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE=''
|
||||||
# Load dependencies for enabling components
|
# Load dependencies for enabling components
|
||||||
# shellcheck disable=SC1090
|
# shellcheck source-path=SCRIPTPATH/vendor/github.com/erichs/composure
|
||||||
source "${BASH_IT}"/vendor/github.com/erichs/composure/composure.sh
|
source "${BASH_IT}/vendor/github.com/erichs/composure/composure.sh"
|
||||||
# shellcheck source=./lib/utilities.bash
|
|
||||||
source "$BASH_IT/lib/utilities.bash"
|
|
||||||
# shellcheck source=./lib/log.bash
|
|
||||||
source "${BASH_IT}/lib/log.bash"
|
|
||||||
cite _about _param _example _group _author _version
|
cite _about _param _example _group _author _version
|
||||||
# shellcheck source=./lib/helpers.bash
|
# shellcheck source-path=SCRIPTDIR/lib
|
||||||
source "$BASH_IT/lib/helpers.bash"
|
source "${BASH_IT}/lib/log.bash"
|
||||||
|
# shellcheck source-path=SCRIPTDIR/lib
|
||||||
|
source "${BASH_IT?}/lib/utilities.bash"
|
||||||
|
# shellcheck source-path=SCRIPTDIR/lib
|
||||||
|
source "${BASH_IT?}/lib/helpers.bash"
|
||||||
|
# shellcheck source-path=SCRIPTDIR/lib
|
||||||
|
source "${BASH_IT?}/lib/colors.bash"
|
||||||
|
|
||||||
if [[ -n $interactive && -z "${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 "${echo_green:-}Enabling ${type}${echo_normal:-}"
|
||||||
_bash-it_load_some "$type"
|
_bash-it-install-enable "$type"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
echo ""
|
echo ""
|
||||||
|
|
@ -224,9 +216,8 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "\033[0;32mInstallation finished successfully! Enjoy bash-it!\033[0m"
|
echo -e "${echo_green:-}Installation finished successfully! Enjoy bash-it!${echo_normal:-}"
|
||||||
# shellcheck disable=SC2086
|
echo -e "${echo_green:-}To start using it, open a new tab or 'source ~/${CONFIG_FILE?}'.${echo_normal:-}"
|
||||||
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"
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,19 @@
|
||||||
#!/usr/bin/env bash
|
# shellcheck shell=bash
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
|
||||||
# If not running interactively, don't do anything
|
# If not running interactively, don't do anything
|
||||||
case $- in
|
case $- in
|
||||||
*i*) ;;
|
*i*) ;;
|
||||||
*) return;;
|
*) return ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Path to the bash it configuration
|
# Path to the bash it configuration
|
||||||
export BASH_IT="{{BASH_IT}}"
|
BASH_IT="{{BASH_IT}}"
|
||||||
|
|
||||||
# Lock and Load a custom theme file.
|
# Lock and Load a custom theme file.
|
||||||
# Leave empty to disable theming.
|
# Leave empty to disable theming.
|
||||||
# location /.bash_it/themes/
|
# location ~/.bash_it/themes/
|
||||||
export BASH_IT_THEME='bobby'
|
BASH_IT_THEME='bobby'
|
||||||
|
|
||||||
# Some themes can show whether `sudo` has a current token or not.
|
# Some themes can show whether `sudo` has a current token or not.
|
||||||
# Set `$THEME_CHECK_SUDO` to `true` to check every prompt:
|
# Set `$THEME_CHECK_SUDO` to `true` to check every prompt:
|
||||||
|
|
@ -20,14 +21,14 @@ export BASH_IT_THEME='bobby'
|
||||||
|
|
||||||
# (Advanced): Change this to the name of your remote repo if you
|
# (Advanced): Change this to the name of your remote repo if you
|
||||||
# cloned bash-it with a remote other than origin such as `bash-it`.
|
# cloned bash-it with a remote other than origin such as `bash-it`.
|
||||||
# export BASH_IT_REMOTE='bash-it'
|
#BASH_IT_REMOTE='bash-it'
|
||||||
|
|
||||||
# (Advanced): Change this to the name of the main development branch if
|
# (Advanced): Change this to the name of the main development branch if
|
||||||
# you renamed it or if it was changed for some reason
|
# you renamed it or if it was changed for some reason
|
||||||
# export BASH_IT_DEVELOPMENT_BRANCH='master'
|
#BASH_IT_DEVELOPMENT_BRANCH='master'
|
||||||
|
|
||||||
# Your place for hosting Git repos. I use this for private repos.
|
# Your place for hosting Git repos. I use this for private repos.
|
||||||
export GIT_HOSTING='git@git.domain.com'
|
#GIT_HOSTING='git@git.domain.com'
|
||||||
|
|
||||||
# Don't check mail when opening terminal.
|
# Don't check mail when opening terminal.
|
||||||
unset MAILCHECK
|
unset MAILCHECK
|
||||||
|
|
@ -36,49 +37,50 @@ unset MAILCHECK
|
||||||
export IRC_CLIENT='irssi'
|
export IRC_CLIENT='irssi'
|
||||||
|
|
||||||
# Set this to the command you use for todo.txt-cli
|
# Set this to the command you use for todo.txt-cli
|
||||||
export TODO="t"
|
TODO="t"
|
||||||
|
|
||||||
# Set this to the location of your work or project folders
|
# Set this to the location of your work or project folders
|
||||||
#BASH_IT_PROJECT_PATHS="${HOME}/Projects:/Volumes/work/src"
|
#BASH_IT_PROJECT_PATHS="${HOME}/Projects:/Volumes/work/src"
|
||||||
|
|
||||||
# Set this to false to turn off version control status checking within the prompt for all themes
|
# Set this to false to turn off version control status checking within the prompt for all themes
|
||||||
export SCM_CHECK=true
|
#SCM_CHECK=true
|
||||||
|
|
||||||
# Set to actual location of gitstatus directory if installed
|
# Set to actual location of gitstatus directory if installed
|
||||||
#export SCM_GIT_GITSTATUS_DIR="$HOME/gitstatus"
|
#SCM_GIT_GITSTATUS_DIR="$HOME/gitstatus"
|
||||||
# per default gitstatus uses 2 times as many threads as CPU cores, you can change this here if you must
|
# per default gitstatus uses 2 times as many threads as CPU cores, you can change this here if you must
|
||||||
#export GITSTATUS_NUM_THREADS=8
|
#export GITSTATUS_NUM_THREADS=8
|
||||||
|
|
||||||
# Set Xterm/screen/Tmux title with only a short hostname.
|
# Set Xterm/screen/Tmux title with only a short hostname.
|
||||||
# Uncomment this (or set SHORT_HOSTNAME to something else),
|
# Uncomment this (or set SHORT_HOSTNAME to something else),
|
||||||
# Will otherwise fall back on $HOSTNAME.
|
# Will otherwise fall back on $HOSTNAME.
|
||||||
#export SHORT_HOSTNAME=$(hostname -s)
|
#SHORT_HOSTNAME=$(hostname -s)
|
||||||
|
|
||||||
# Set Xterm/screen/Tmux title with only a short username.
|
# Set Xterm/screen/Tmux title with only a short username.
|
||||||
# Uncomment this (or set SHORT_USER to something else),
|
# Uncomment this (or set SHORT_USER to something else),
|
||||||
# Will otherwise fall back on $USER.
|
# Will otherwise fall back on $USER.
|
||||||
#export SHORT_USER=${USER:0:8}
|
#SHORT_USER=${USER:0:8}
|
||||||
|
|
||||||
# If your theme use command duration, uncomment this to
|
# If your theme use command duration, uncomment this to
|
||||||
# enable display of last command duration.
|
# enable display of last command duration.
|
||||||
#export BASH_IT_COMMAND_DURATION=true
|
#BASH_IT_COMMAND_DURATION=true
|
||||||
# You can choose the minimum time in seconds before
|
# You can choose the minimum time in seconds before
|
||||||
# command duration is displayed.
|
# command duration is displayed.
|
||||||
#export COMMAND_DURATION_MIN_SECONDS=1
|
#COMMAND_DURATION_MIN_SECONDS=1
|
||||||
|
|
||||||
# Set Xterm/screen/Tmux title with shortened command and directory.
|
# Set Xterm/screen/Tmux title with shortened command and directory.
|
||||||
# Uncomment this to set.
|
# Uncomment this to set.
|
||||||
#export SHORT_TERM_LINE=true
|
#SHORT_TERM_LINE=true
|
||||||
|
|
||||||
# Set vcprompt executable path for scm advance info in prompt (demula theme)
|
# Set vcprompt executable path for scm advance info in prompt (demula theme)
|
||||||
# https://github.com/djl/vcprompt
|
# https://github.com/djl/vcprompt
|
||||||
#export VCPROMPT_EXECUTABLE=~/.vcprompt/bin/vcprompt
|
#VCPROMPT_EXECUTABLE=~/.vcprompt/bin/vcprompt
|
||||||
|
|
||||||
# (Advanced): Uncomment this to make Bash-it reload itself automatically
|
# (Advanced): Uncomment this to make Bash-it reload itself automatically
|
||||||
# after enabling or disabling aliases, plugins, and completions.
|
# after enabling or disabling aliases, plugins, and completions.
|
||||||
# export BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE=1
|
# BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE=1
|
||||||
|
|
||||||
# Uncomment this to make Bash-it create alias reload.
|
# Uncomment this to make Bash-it create alias reload.
|
||||||
# export BASH_IT_RELOAD_LEGACY=1
|
# BASH_IT_RELOAD_LEGACY=1
|
||||||
|
|
||||||
# Load Bash It
|
# Load Bash It
|
||||||
source "$BASH_IT"/bash_it.sh
|
source "${BASH_IT?}/bash_it.sh"
|
||||||
|
|
@ -8,15 +8,7 @@ function local_setup() {
|
||||||
|
|
||||||
function local_setup_file() {
|
function local_setup_file() {
|
||||||
# Determine which config file to use based on OS.
|
# Determine which config file to use based on OS.
|
||||||
case $OSTYPE in
|
export BASH_IT_CONFIG_FILE=.bashrc
|
||||||
darwin*)
|
|
||||||
export BASH_IT_CONFIG_FILE=.bash_profile
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
export BASH_IT_CONFIG_FILE=.bashrc
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
# don't load any libraries as the tests here test the *whole* kit
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "install: verify that the install script exists" {
|
@test "install: verify that the install script exists" {
|
||||||
|
|
@ -84,5 +76,5 @@ function local_setup_file() {
|
||||||
run cat "$HOME/$BASH_IT_CONFIG_FILE"
|
run cat "$HOME/$BASH_IT_CONFIG_FILE"
|
||||||
|
|
||||||
assert_line "test file content"
|
assert_line "test file content"
|
||||||
assert_line "source \"\$BASH_IT\"/bash_it.sh"
|
assert_line 'source "${BASH_IT?}/bash_it.sh"'
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,55 +7,85 @@ function local_setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function local_setup_file() {
|
function local_setup_file() {
|
||||||
# Determine which config file to use based on OS.
|
: # don't load any libraries as the tests here test the *whole* kit
|
||||||
case $OSTYPE in
|
|
||||||
darwin*)
|
|
||||||
export BASH_IT_CONFIG_FILE=.bash_profile
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
export BASH_IT_CONFIG_FILE=.bashrc
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
# don't load any libraries as the tests here test the *whole* kit
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "uninstall: verify that the uninstall script exists" {
|
@test "uninstall: verify that the uninstall script exists" {
|
||||||
assert_file_exist "$BASH_IT/uninstall.sh"
|
assert_file_exist "$BASH_IT/uninstall.sh"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "uninstall: run the uninstall script with an existing backup file" {
|
@test "uninstall: run the uninstall script with existing backup 'bashrc'" {
|
||||||
cd "$BASH_IT"
|
BASH_IT_CONFIG_FILE=.bashrc
|
||||||
|
|
||||||
echo "test file content for backup" > "$HOME/$BASH_IT_CONFIG_FILE.bak"
|
echo "test file content for backup" > "${HOME?}/$BASH_IT_CONFIG_FILE.bak"
|
||||||
echo "test file content for original file" > "$HOME/$BASH_IT_CONFIG_FILE"
|
echo "test file content for original BASH_IT file" > "${HOME?}/$BASH_IT_CONFIG_FILE"
|
||||||
local md5_bak=$(md5sum "$HOME/$BASH_IT_CONFIG_FILE.bak" | awk '{print $1}')
|
local md5_bak=$(md5sum "${HOME?}/$BASH_IT_CONFIG_FILE.bak" | awk '{print $1}')
|
||||||
|
|
||||||
run ./uninstall.sh
|
run "${BASH_IT?}/uninstall.sh"
|
||||||
assert_success
|
assert_success
|
||||||
|
assert_output --partial "Your original ~/$BASH_IT_CONFIG_FILE has been restored."
|
||||||
|
|
||||||
assert_file_not_exist "$HOME/$BASH_IT_CONFIG_FILE.uninstall"
|
assert_file_not_exist "${HOME?}/$BASH_IT_CONFIG_FILE.uninstall"
|
||||||
assert_file_not_exist "$HOME/$BASH_IT_CONFIG_FILE.bak"
|
assert_file_not_exist "${HOME?}/$BASH_IT_CONFIG_FILE.bak"
|
||||||
assert_file_exist "$HOME/$BASH_IT_CONFIG_FILE"
|
assert_file_exist "${HOME?}/$BASH_IT_CONFIG_FILE"
|
||||||
|
|
||||||
local md5_conf=$(md5sum "$HOME/$BASH_IT_CONFIG_FILE" | awk '{print $1}')
|
local md5_conf=$(md5sum "${HOME?}/$BASH_IT_CONFIG_FILE" | awk '{print $1}')
|
||||||
|
|
||||||
assert_equal "$md5_bak" "$md5_conf"
|
assert_equal "$md5_bak" "$md5_conf"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "uninstall: run the uninstall script without an existing backup file" {
|
@test "uninstall: run the uninstall script with existing backup 'bash_profile'" {
|
||||||
cd "$BASH_IT"
|
BASH_IT_CONFIG_FILE=.bash_profile
|
||||||
|
|
||||||
echo "test file content for original file" > "$HOME/$BASH_IT_CONFIG_FILE"
|
echo "test file content for backup file" > "${HOME?}/$BASH_IT_CONFIG_FILE.bak"
|
||||||
local md5_orig=$(md5sum "$HOME/$BASH_IT_CONFIG_FILE" | awk '{print $1}')
|
echo "test file content for original BASH_IT file" > "${HOME?}/$BASH_IT_CONFIG_FILE"
|
||||||
|
local md5_bak=$(md5sum "${HOME?}/$BASH_IT_CONFIG_FILE.bak" | awk '{print $1}')
|
||||||
|
|
||||||
run ./uninstall.sh
|
run "${BASH_IT?}/uninstall.sh"
|
||||||
assert_success
|
assert_success
|
||||||
|
|
||||||
assert_file_exist "$HOME/$BASH_IT_CONFIG_FILE.uninstall"
|
assert_file_not_exist "${HOME?}/$BASH_IT_CONFIG_FILE.uninstall"
|
||||||
assert_file_not_exist "$HOME/$BASH_IT_CONFIG_FILE.bak"
|
assert_file_not_exist "${HOME?}/$BASH_IT_CONFIG_FILE.bak"
|
||||||
assert_file_not_exist "$HOME/$BASH_IT_CONFIG_FILE"
|
assert_file_exist "${HOME?}/$BASH_IT_CONFIG_FILE"
|
||||||
|
|
||||||
local md5_uninstall=$(md5sum "$HOME/$BASH_IT_CONFIG_FILE.uninstall" | awk '{print $1}')
|
local md5_conf=$(md5sum "${HOME?}/$BASH_IT_CONFIG_FILE" | awk '{print $1}')
|
||||||
|
|
||||||
|
assert_equal "$md5_bak" "$md5_conf"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "uninstall: run the uninstall script without existing backup 'bashrc" {
|
||||||
|
BASH_IT_CONFIG_FILE=.bashrc
|
||||||
|
|
||||||
|
echo "test file content for original BASH_IT file" > "${HOME?}/$BASH_IT_CONFIG_FILE"
|
||||||
|
local md5_orig=$(md5sum "${HOME?}/$BASH_IT_CONFIG_FILE" | awk '{print $1}')
|
||||||
|
|
||||||
|
run "${BASH_IT?}/uninstall.sh"
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
assert_file_exist "${HOME?}/$BASH_IT_CONFIG_FILE.uninstall"
|
||||||
|
assert_file_not_exist "${HOME?}/$BASH_IT_CONFIG_FILE.bak"
|
||||||
|
assert_file_not_exist "${HOME?}/$BASH_IT_CONFIG_FILE"
|
||||||
|
|
||||||
|
local md5_uninstall=$(md5sum "${HOME?}/$BASH_IT_CONFIG_FILE.uninstall" | awk '{print $1}')
|
||||||
|
|
||||||
|
assert_equal "$md5_orig" "$md5_uninstall"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "uninstall: run the uninstall script without existing backup 'bash_profile" {
|
||||||
|
BASH_IT_CONFIG_FILE=.bash_profile
|
||||||
|
|
||||||
|
echo "test file content for original BASH_IT file" > "${HOME?}/$BASH_IT_CONFIG_FILE"
|
||||||
|
local md5_orig=$(md5sum "${HOME?}/$BASH_IT_CONFIG_FILE" | awk '{print $1}')
|
||||||
|
|
||||||
|
run "${BASH_IT?}/uninstall.sh"
|
||||||
|
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
assert_file_exist "${HOME?}/$BASH_IT_CONFIG_FILE.uninstall"
|
||||||
|
assert_file_not_exist "${HOME?}/$BASH_IT_CONFIG_FILE.bak"
|
||||||
|
assert_file_not_exist "${HOME?}/$BASH_IT_CONFIG_FILE"
|
||||||
|
|
||||||
|
local md5_uninstall=$(md5sum "${HOME?}/$BASH_IT_CONFIG_FILE.uninstall" | awk '{print $1}')
|
||||||
|
|
||||||
assert_equal "$md5_orig" "$md5_uninstall"
|
assert_equal "$md5_orig" "$md5_uninstall"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
66
uninstall.sh
66
uninstall.sh
|
|
@ -1,36 +1,50 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
if [ -z "$BASH_IT" ];
|
#
|
||||||
then
|
# Since we're uninstalling, avoid depending on any other part of _Bash It_.
|
||||||
BASH_IT="$HOME/.bash_it"
|
# I.e., hard-code colors (avoid `lib/colors.bash`), &c.
|
||||||
|
|
||||||
|
: "${BASH_IT:=${HOME?}/.bash_it}"
|
||||||
|
|
||||||
|
if [[ ! -e ~/.bashrc && ! -e ~/.bash_profile && ! -e ~/.bashrc.bak && ! -e ~/.bash_profile.bak ]]; then
|
||||||
|
echo "We can't locate your configuration files, so we can't uninstall..."
|
||||||
|
return
|
||||||
|
elif grep -F -q -- BASH_IT ~/.bashrc && grep -F -q -- BASH_IT ~/.bash_profile; then
|
||||||
|
echo "We can't figure out if Bash-it is loaded from ~/.bashrc or ~/.bash_profile..."
|
||||||
|
return
|
||||||
|
elif grep -F -q -- BASH_IT ~/.bashrc || [[ -e ~/.bashrc.bak && ! -e ~/.bashrc ]]; then
|
||||||
|
CONFIG_FILE=".bashrc"
|
||||||
|
elif grep -F -q -- BASH_IT ~/.bash_profile || [[ -e ~/.bash_profile.bak && ! -e ~/.bash_profile ]]; then
|
||||||
|
CONFIG_FILE=".bash_profile"
|
||||||
|
else
|
||||||
|
echo "Bash-it does not appear to be installed."
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case $OSTYPE in
|
# possible states:
|
||||||
darwin*)
|
# - both .bash* /and/ .bash*.bak, /and/ both config reference `$BASH_IT`: no solution
|
||||||
CONFIG_FILE=.bash_profile
|
# - both config and bak, but only one references `$BASH_IT`: that one
|
||||||
;;
|
# - both config, only one bak, but other references `$BASH_IT`: the other one?
|
||||||
*)
|
# - both config, no bak, with `$BASH_IT` reference: that one
|
||||||
CONFIG_FILE=.bashrc
|
# - one config, no bak, but no `$BASH_IT` reference: wut
|
||||||
;;
|
# - no config, with bak, with `$BASH_IT`: re-create???
|
||||||
esac
|
# - no config, no bak: nothing.
|
||||||
|
|
||||||
BACKUP_FILE=$CONFIG_FILE.bak
|
BACKUP_FILE=$CONFIG_FILE.bak
|
||||||
|
|
||||||
if [ ! -e "$HOME/$BACKUP_FILE" ]; then
|
if [[ ! -e "${HOME?}/$BACKUP_FILE" ]]; then
|
||||||
echo -e "\033[0;33mBackup file $HOME/$BACKUP_FILE not found.\033[0m" >&2
|
printf '\e[0;33m%s\e[0m\n' "Backup file ~/$BACKUP_FILE not found."
|
||||||
|
|
||||||
test -w "$HOME/$CONFIG_FILE" &&
|
test -w "${HOME?}/$CONFIG_FILE" \
|
||||||
mv "$HOME/$CONFIG_FILE" "$HOME/$CONFIG_FILE.uninstall" &&
|
&& mv "${HOME?}/$CONFIG_FILE" "${HOME?}/$CONFIG_FILE.uninstall" \
|
||||||
echo -e "\033[0;32mMoved your $HOME/$CONFIG_FILE to $HOME/$CONFIG_FILE.uninstall.\033[0m"
|
&& printf '\e[0;32m%s\e[0m\n' "Moved your ~/$CONFIG_FILE to ~/$CONFIG_FILE.uninstall."
|
||||||
else
|
else
|
||||||
test -w "$HOME/$BACKUP_FILE" &&
|
test -w "${HOME?}/$BACKUP_FILE" \
|
||||||
cp -a "$HOME/$BACKUP_FILE" "$HOME/$CONFIG_FILE" &&
|
&& cp -a "${HOME?}/$BACKUP_FILE" "${HOME?}/$CONFIG_FILE" \
|
||||||
rm "$HOME/$BACKUP_FILE" &&
|
&& rm "${HOME?}/$BACKUP_FILE" \
|
||||||
echo -e "\033[0;32mYour original $CONFIG_FILE has been restored.\033[0m"
|
&& printf '\e[0;32m%s\e[0m\n' "Your original ~/$CONFIG_FILE has been restored."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
printf '\n\e[0;32m%s\e[0m\n\n' "Uninstallation finished successfully! Sorry to see you go!"
|
||||||
echo -e "\033[0;32mUninstallation finished successfully! Sorry to see you go!\033[0m"
|
printf '%s\n' "Final steps to complete the uninstallation:"
|
||||||
echo ""
|
printf '\t%s\n' "-> Remove the ${BASH_IT//${HOME?}/\~} folder"
|
||||||
echo "Final steps to complete the uninstallation:"
|
printf '\t%s\n' "-> Open a new shell/tab/terminal"
|
||||||
echo " -> Remove the $BASH_IT folder"
|
|
||||||
echo " -> Open a new shell/tab/terminal"
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue