forked from viur-framework/viur-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
postinstall.sh
executable file
·29 lines (28 loc) · 936 Bytes
/
postinstall.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env bash
if [[ $(basename $SHELL) = 'bash' ]];
then
if [ -f ~/.bashrc ];
then
echo "Installing bash autocompletion..."
grep -q 'viur-autocompletion' ~/.bashrc
if [[ $? -ne 0 ]]; then
echo "" >> ~/.bashrc
echo 'eval "$(_VIUR_COMPLETE=bash_source viur)"' >> ~/.viur-autocompletion.sh
echo "source ~/.viur-autocompletion.sh" >> ~/.bashrc
fi
fi
elif [[ $(basename $SHELL) = 'zsh' ]];
then
if [ -f ~/.zshrc ];
then
echo "Installing zsh autocompletion..."
grep -q 'ecli-autocompletion' ~/.zshrc
if [[ $? -ne 0 ]]; then
echo "" >> ~/.zshrc
echo "autoload bashcompinit" >> ~/.zshrc
echo "bashcompinit" >> ~/.zshrc
echo 'eval "$(_VIUR_COMPLETE=source ecli)"' >> ~/.viur-autocompletion.sh
echo "source ~/.viur-autocompletion.sh" >> ~/.zshrc
fi
fi
fi