Skip to content

Commit

Permalink
Add ability to choose what plugins/aliases/completion to install at i…
Browse files Browse the repository at this point in the history
…nstall time
  • Loading branch information
Mark Szymanski committed Jul 24, 2011
1 parent 80ec9c0 commit 3eff6b2
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
BASH="$HOME/.bash_it"

cp $HOME/.bash_profile $HOME/.bash_profile.bak

Expand Down Expand Up @@ -26,3 +27,62 @@ do
echo "Please enter Y or N"
esac
done

function load_all() {
for file_type in "aliases" "completion" "plugins"
do
[ ! -d "$BASH/$file_type/enabled" ] && mkdir "$BASH/${file_type}/enabled"
ln -s $BASH/${file_type}/available/* "${BASH}/${file_type}/enabled"
done
}

function load_some() {
for file_type in "aliases" "completion" "plugins"
do
for file in `ls $BASH/${file_type}/available`
do
if [ ! -d "$BASH/$file_type/enabled" ]
then
mkdir "$BASH/$file_type/enabled"
fi
while true
do
read -p "Would you like to enable the ${file%.*.*} $file_type? [Y/N] " RESP
case $RESP in
[yY])
ln -s "$BASH/$file_type/available/$file" "$BASH/$file_type/enabled"
;;
[nN])
break
;;
*)
echo "Please choose y or n."
;;
esac
done
done
done
}

while true
do
read -p "Would you like to enable all, some, or no plugins/aliases/tab-completion plugins? Some of these may make bash slower to start up. (all/some/none) " RESP
case $RESP
in
some)
load_some
break
;;
all)
load_all
break
;;
none)
break
;;
*)
echo "Unknown choice. Please enter some, all, or none"
continue
;;
esac
done

0 comments on commit 3eff6b2

Please sign in to comment.