Skip to content

Commit f3ca9f5

Browse files
committed
Added option for skipping questions in installer.
The install script now allows to specify one of the following options: * --all * --none Both result in any questions being skipped. This is convenient when running the install script from a script, or a provisioning tool like Ansible.
1 parent 87ba476 commit f3ca9f5

File tree

2 files changed

+57
-39
lines changed

2 files changed

+57
-39
lines changed

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ Includes autocompletion, themes, aliases, custom functions, a few stolen pieces
1616
The install script will also prompt you asking if you use [Jekyll](https://github.com/mojombo/jekyll).
1717
This is to set up the `.jekyllconfig` file, which stores info necessary to use the Jekyll plugin.
1818

19+
**INSTALL OPTIONS:**
20+
The install script can take the following options:
21+
22+
* `--all`: Enable all aliases, plugins and completions.
23+
* `--none`: Don't enable any aliases, plugins or completions.
24+
25+
If none of these parameters is provided, the install script will ask the user.
1926

2027
## Help Screens
2128

install.sh

+50-39
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,6 @@ cp $HOME/.bash_it/template/bash_profile.template.bash $HOME/$CONFIG_FILE
1818

1919
echo "Copied the template $CONFIG_FILE into ~/$CONFIG_FILE, edit this file to customize bash-it"
2020

21-
while true
22-
do
23-
read -p "Do you use Jekyll? (If you don't know what Jekyll is, answer 'n') [Y/N] " RESP
24-
25-
case $RESP in
26-
[yY])
27-
cp $HOME/.bash_it/template/jekyllconfig.template.bash $HOME/.jekyllconfig
28-
echo "Copied the template .jekyllconfig into your home directory. Edit this file to customize bash-it for using the Jekyll plugins"
29-
break
30-
;;
31-
[nN])
32-
break
33-
;;
34-
*)
35-
echo "Please enter Y or N"
36-
esac
37-
done
38-
3921
function load_all() {
4022
file_type=$1
4123
[ ! -d "$BASH_IT/$file_type/enabled" ] && mkdir "$BASH_IT/${file_type}/enabled"
@@ -77,28 +59,57 @@ function load_some() {
7759
done
7860
}
7961

80-
for type in "aliases" "plugins" "completion"
81-
do
62+
if [[ "$1" == "--none" ]]
63+
then
64+
echo "Not enabling any aliases, plugins or completions"
65+
elif [[ "$1" == "--all" ]]
66+
then
67+
echo "Enabling all aliases, plugins and completions."
68+
load_all aliases
69+
load_all plugins
70+
load_all completion
71+
else
8272
while true
8373
do
84-
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
85-
case $RESP
86-
in
87-
some)
88-
load_some $type
89-
break
90-
;;
91-
all)
92-
load_all $type
93-
break
94-
;;
95-
none)
96-
break
97-
;;
98-
*)
99-
echo "Unknown choice. Please enter some, all, or none"
100-
continue
101-
;;
74+
read -p "Do you use Jekyll? (If you don't know what Jekyll is, answer 'n') [Y/N] " RESP
75+
76+
case $RESP in
77+
[yY])
78+
cp $HOME/.bash_it/template/jekyllconfig.template.bash $HOME/.jekyllconfig
79+
echo "Copied the template .jekyllconfig into your home directory. Edit this file to customize bash-it for using the Jekyll plugins"
80+
break
81+
;;
82+
[nN])
83+
break
84+
;;
85+
*)
86+
echo "Please enter Y or N"
10287
esac
10388
done
104-
done
89+
90+
for type in "aliases" "plugins" "completion"
91+
do
92+
while true
93+
do
94+
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
95+
case $RESP
96+
in
97+
some)
98+
load_some $type
99+
break
100+
;;
101+
all)
102+
load_all $type
103+
break
104+
;;
105+
none)
106+
break
107+
;;
108+
*)
109+
echo "Unknown choice. Please enter some, all, or none"
110+
continue
111+
;;
112+
esac
113+
done
114+
done
115+
fi

0 commit comments

Comments
 (0)