Added load_some function again

It can be called by providing the `--interactive` switch to the install
script.
pull/543/head
Nils Winkler 2015-08-06 16:18:25 +02:00
parent 237816b782
commit 63add1f86a
2 changed files with 44 additions and 5 deletions

View File

@ -11,11 +11,16 @@ Bash it provides a solid framework for using, developing and maintaining shell s
## Install
1. Check a clone of this repo: `git clone --depth=1 https://github.com/Bash-it/bash-it.git ~/.bash_it`
2. Run `~/.bash_it/install.sh` (it automatically backs up your `~/.bash_profile` or `~/.bashrc`, depends on your OS)
2. Run `~/.bash_it/install.sh` (it automatically backs up your `~/.bash_profile` or `~/.bashrc`, depending on your OS)
3. Edit your modified config (`~/.bash_profile` or `~/.bashrc`) file in order to customize Bash it.
4. Check out available aliases, completions and plugins and enable the ones you want to use (see the next section for more details).
Bash it only enables a sane default set of functionality to keep your shell lean and to avoid issues with missing dependencies. Feel free to enable the tools you want to use after the installation.
**INSTALL OPTIONS:**
The install script can take the following options:
* `--interactive`: Asks the user which aliases, completions and plugins to enable.
When run without the `--interactive` switch, Bash it only enables a sane default set of functionality to keep your shell lean and to avoid issues with missing dependencies. Feel free to enable the tools you want to use after the installation.
## Help Screens

View File

@ -53,9 +53,43 @@ function load_one() {
fi
}
function load_some() {
file_type=$1
[ -d "$BASH_IT/$file_type/enabled" ] || mkdir "$BASH_IT/$file_type/enabled"
for path in `ls $BASH_IT/${file_type}/available/[^_]*`
do
file_name=$(basename "$path")
while true
do
read -e -n 1 -p "Would you like to enable the ${file_name%%.*} $file_type? [y/N] " RESP
case $RESP in
[yY])
ln -s "../available/${file_name}" "$BASH_IT/$file_type/enabled"
break
;;
[nN]|"")
break
;;
*)
echo -e "\033[91mPlease choose y or n.\033[m"
;;
esac
done
done
}
if [[ "$1" == "--interactive" ]]
then
for type in "aliases" "plugins" "completion"
do
echo -e "\033[0;32mEnabling $type\033[0m"
load_some $type
done
else
echo ""
echo "Enabling sane defaults"
echo -e "\033[0;32mEnabling sane defaults\033[0m"
load_one completion bash-it.completion.bash
fi
echo ""
echo -e "\033[0;32mInstallation finished successfully! Enjoy bash-it!\033[0m"