mirror of
https://github.com/nvbn/thefuck.git
synced 2025-02-21 20:38:54 +00:00
#346 Improve installation script
This commit is contained in:
parent
5e5a8e4dfa
commit
f4eebbaaf9
16
install.sh
16
install.sh
@ -1,10 +1,16 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
should_add_alias () {
|
||||||
|
[ -f $1 ] && ! grep -q thefuck $1
|
||||||
|
}
|
||||||
|
|
||||||
# Install os dependencies:
|
# Install os dependencies:
|
||||||
if [ -f $(which apt-get) ]; then
|
if [ -f $(which apt-get) ]; then
|
||||||
|
sudo apt-get update
|
||||||
sudo apt-get install python-pip
|
sudo apt-get install python-pip
|
||||||
else
|
else
|
||||||
if [ -f $(which brew) ]; then
|
if [ -f $(which brew) ]; then
|
||||||
|
brew update
|
||||||
brew install python
|
brew install python
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -14,22 +20,22 @@ sudo pip install -U pip setuptools
|
|||||||
sudo pip install -U thefuck
|
sudo pip install -U thefuck
|
||||||
|
|
||||||
# Setup aliases:
|
# Setup aliases:
|
||||||
if [ -f ~/.bashrc ]; then
|
if should_add_alias ~/.bashrc; then
|
||||||
echo 'eval $(thefuck --alias)' >> ~/.bashrc
|
echo 'eval $(thefuck --alias)' >> ~/.bashrc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f ~/.bash_profile ]; then
|
if should_add_alias ~/.bash_profile; then
|
||||||
echo 'eval $(thefuck --alias)' >> ~/.bash_profile
|
echo 'eval $(thefuck --alias)' >> ~/.bash_profile
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f ~/.zshrc ]; then
|
if should_add_alias ~/.zshrc; then
|
||||||
echo 'eval $(thefuck --alias)' >> ~/.zshrc
|
echo 'eval $(thefuck --alias)' >> ~/.zshrc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f ~/.config/fish/config.fish ]; then
|
if should_add_alias ~/.config/fish/config.fish; then
|
||||||
thefuck --alias >> ~/.config/fish/config.fish
|
thefuck --alias >> ~/.config/fish/config.fish
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f ~/.tcshrc ]; then
|
if should_add_alias ~/.tcshrc; then
|
||||||
echo 'eval `thefuck --alias`' >> ~/.tcshrc
|
echo 'eval `thefuck --alias`' >> ~/.tcshrc
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user