blob: a80a74997ed9b1b1010242af53e0ba7cb2dc90be [file] [log] [blame]
Mark Szymanskid82d8fb2011-06-28 00:22:43 -05001#!/usr/bin/env bash
John Schulz323ce202011-09-20 11:07:48 -04002BASH_IT="$HOME/.bash_it"
Mark Szymanskid82d8fb2011-06-28 00:22:43 -05003
4cp $HOME/.bash_profile $HOME/.bash_profile.bak
5
6echo "Your original .bash_profile has been backed up to .bash_profile.bak"
7
8cp $HOME/.bash_it/template/bash_profile.template.bash $HOME/.bash_profile
9
10echo "Copied the template .bash_profile into ~/.bash_profile, edit this file to customize bash-it"
11
12while true
13do
14 read -p "Do you use Jekyll? (If you don't know what Jekyll is, answer 'n') [Y/N] " RESP
15
16 case $RESP
17 in
18 [yY])
19 cp $HOME/.bash_it/template/jekyllconfig.template.bash $HOME/.jekyllconfig
20 echo "Copied the template .jekyllconfig into your home directory. Edit this file to customize bash-it for using the Jekyll plugins"
21 break
22 ;;
23 [nN])
24 break
25 ;;
26 *)
27 echo "Please enter Y or N"
28 esac
29done
Mark Szymanski3eff6b22011-07-24 13:36:07 -050030
31function load_all() {
Mark Szymanski159e1e42011-07-24 15:01:07 -050032 file_type=$1
John Schulz323ce202011-09-20 11:07:48 -040033 [ ! -d "$BASH_IT/$file_type/enabled" ] && mkdir "$BASH_IT/${file_type}/enabled"
34 ln -s $BASH_IT/${file_type}/available/* "${BASH_IT}/${file_type}/enabled"
Mark Szymanski3eff6b22011-07-24 13:36:07 -050035}
36
37function load_some() {
Mark Szymanski159e1e42011-07-24 15:01:07 -050038 file_type=$1
John Schulz323ce202011-09-20 11:07:48 -040039 for file in `ls $BASH_IT/${file_type}/available`
Mark Szymanski3eff6b22011-07-24 13:36:07 -050040 do
John Schulz323ce202011-09-20 11:07:48 -040041 if [ ! -d "$BASH_IT/$file_type/enabled" ]
Mark Szymanski3eff6b22011-07-24 13:36:07 -050042 then
John Schulz323ce202011-09-20 11:07:48 -040043 mkdir "$BASH_IT/$file_type/enabled"
Mark Szymanski3eff6b22011-07-24 13:36:07 -050044 fi
45 while true
46 do
47 read -p "Would you like to enable the ${file%.*.*} $file_type? [Y/N] " RESP
48 case $RESP in
49 [yY])
John Schulz323ce202011-09-20 11:07:48 -040050 ln -s "$BASH_IT/$file_type/available/$file" "$BASH_IT/$file_type/enabled"
Victor Castell55c32cc2011-07-25 13:34:39 +020051 break
Mark Szymanski3eff6b22011-07-24 13:36:07 -050052 ;;
53 [nN])
54 break
55 ;;
56 *)
57 echo "Please choose y or n."
58 ;;
59 esac
60 done
61 done
Mark Szymanski3eff6b22011-07-24 13:36:07 -050062}
63
Mark Szymanski159e1e42011-07-24 15:01:07 -050064for type in "aliases" "plugins" "completion"
Mark Szymanski3eff6b22011-07-24 13:36:07 -050065do
Mark Szymanski159e1e42011-07-24 15:01:07 -050066 while true
67 do
68 read -p "Would you like to enable all, some, or no $type? Some of these may make bash slower to start up (especially completion). (all/some/none) " RESP
69 case $RESP
70 in
71 some)
72 load_some $type
73 break
74 ;;
75 all)
76 load_all $type
77 break
78 ;;
79 none)
80 break
81 ;;
82 *)
83 echo "Unknown choice. Please enter some, all, or none"
84 continue
85 ;;
86 esac
87 done
Mark Szymanski3eff6b22011-07-24 13:36:07 -050088done