-
Notifications
You must be signed in to change notification settings - Fork 263
/
setup_autocomplete.sh
executable file
·30 lines (29 loc) · 1.27 KB
/
setup_autocomplete.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
30
#!/usr/bin/env bash
#----------------------------------------------------#
# Gimme-aws-creds post-installation script.
# This script adds the CLI autocomplete to your shell's environment.
#----------------------------------------------------#
INSTALL_DIR=$(dirname $(which gimme-aws-creds))
if [ "$(basename $SHELL)" = "bash" ] && [ -f ~/.bashrc ] ; then
grep -q 'gimme-aws-creds-autocomplete' ~/.bashrc
if [[ $? -ne 0 ]] ; then
echo "Adding autocomplete setup to ~/.bashrc"
echo "Source in .bashrc or simply restart your shell."
echo "" >> ~/.bashrc
echo "# Loading gimme-aws-creds CLI autocomplete:" >> ~/.bashrc
echo "source ${INSTALL_DIR}/gimme-aws-creds-autocomplete.sh" >> ~/.bashrc
fi
elif [ "$(basename $SHELL)" = "zsh" ] && [ -f ~/.zshrc ] ; then
grep -q 'gimme-aws-creds-autocompletion' ~/.zshrc
if [[ $? -ne 0 ]] ; then
echo "Adding autocomplete setup to ~/.zshrc"
echo "Source in .zshrc or simply restart your shell."
echo "" >> ~/.zshrc
echo "# Loading gimme-aws-creds CLI autocomplete:" >> ~/.zshrc
echo "autoload bashcompinit" >> ~/.zshrc
echo "bashcompinit" >> ~/.zshrc
echo "source ${INSTALL_DIR}/gimme-aws-creds-autocomplete.sh" >> ~/.zshrc
fi
else
echo "Not sure how to install this in your shell: $(basename $SHELL)"
fi