diff --git a/README.md b/README.md index 9f12f5a6..d3ed2c9c 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/install.sh b/install.sh index 1777e177..3baa1d58 100755 --- a/install.sh +++ b/install.sh @@ -53,9 +53,43 @@ function load_one() { fi } -echo "" -echo "Enabling sane defaults" -load_one completion bash-it.completion.bash +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 -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"