Rewrite installation script in fish shell.

That now means oh my fish requires fish to be installed, but this is
probably for the better.
This commit is contained in:
Konrad Borowski 2014-04-04 18:17:05 +02:00
parent 9f7459b740
commit d0cc1e7f70
3 changed files with 69 additions and 53 deletions

View File

@ -16,7 +16,7 @@
Oh-my-fish is built for recent versions of the fish shell, namely "fish 2.0".
curl -L https://github.com/bpinto/oh-my-fish/raw/master/tools/install.sh | sh
curl -L https://github.com/bpinto/oh-my-fish/raw/master/tools/install.fish | fish
If you want to install it manually, keep reading.

68
tools/install.fish Normal file
View File

@ -0,0 +1,68 @@
#!/usr/bin/env fish
# Takes color as first argument, and text to print as other arguments.
function colored
set_color $argv[1]
set -e argv[1]
echo $argv
set_color normal
end
if test -d ~/.oh-my-fish
colored yellow -n You already have Oh My Fish installed.
echo " You'll need to remove ~/.oh-my-fish if you want to install"
exit
end
colored blue Cloning Oh My Fish...
type git >/dev/null
and git clone https://github.com/bpinto/oh-my-fish.git ~/.oh-my-fish
or begin
echo git not installed
exit
end
colored blue Looking for an existing fish config...
if test -f ~/.config/fish/config.fish
colored yellow -n "Found ~/.config/fish/config.fish."
colored green " Backing up to ~/.config/fish/config.orig"
mv ~/.config/fish/config.{fish,orig}
end
colored blue "Using the Oh My Fish template file and adding it to ~/.config/fish/config.fish"
cp ~/.oh-my-fish/templates/config.fish ~/.config/fish/config.fish
colored green \
' _
| |
___ | |__ _ __ ___ _ _
/ _ \| _ \ | _ ` _ \| | | |
| (_) | | | | | | | | | | |_| |
\___/|_| |_| |_| |_| |_|\__, |
__/ |
|___/
'
# Print nice fish logo with colors.
echo ' '(set_color F00)'___
___======____='(set_color FF7F00)'-'(set_color FF0)'-'(set_color FF7F00)'-='(set_color F00)')
/T \_'(set_color FF0)'--='(set_color FF7F00)'=='(set_color F00)')
[ \ '(set_color FF7F00)'('(set_color FF0)'0'(set_color FF7F00)') '(set_color F00)'\~ \_'(set_color FF0)'-='(set_color FF7F00)'='(set_color F00)')
\ / )J'(set_color FF7F00)'~~ \\'(set_color FF0)'-='(set_color F00)')
\\\\___/ )JJ'(set_color FF7F00)'~'(set_color FF0)'~~ '(set_color F00)'\)
\_____/JJJ'(set_color FF7F00)'~~'(set_color FF0)'~~ '(set_color F00)'\\
'(set_color FF7F00)'/ '(set_color FF0)'\ '(set_color FF0)', \\'(set_color F00)'J'(set_color FF7F00)'~~~'(set_color FF0)'~~ '(set_color FF7F00)'\\
(-'(set_color FF0)'\)'(set_color F00)'\='(set_color FF7F00)'|'(set_color FF0)'\\\\\\'(set_color FF7F00)'~~'(set_color FF0)'~~ '(set_color FF7F00)'L_'(set_color FF0)'_
'(set_color FF7F00)'('(set_color F00)'\\'(set_color FF7F00)'\\) ('(set_color FF0)'\\'(set_color FF7F00)'\\\)'(set_color F00)'_ '(set_color FF0)'\=='(set_color FF7F00)'__
'(set_color F00)'\V '(set_color FF7F00)'\\\\'(set_color F00)'\) =='(set_color FF7F00)'=_____ '(set_color FF0)'\\\\\\\\'(set_color FF7F00)'\\\\
'(set_color F00)'\V) \_) '(set_color FF7F00)'\\\\'(set_color FF0)'\\\\JJ\\'(set_color FF7F00)'J\)
'(set_color F00)'/'(set_color FF7F00)'J'(set_color FF0)'\\'(set_color FF7F00)'J'(set_color F00)'T\\'(set_color FF7F00)'JJJ'(set_color F00)'J)
(J'(set_color FF7F00)'JJ'(set_color F00)'| \UUU)
(UU)'(set_color normal)
echo
echo
colored green ' ....is now installed.'
# Run shell after installation.
fish

View File

@ -1,52 +0,0 @@
#!/bin/bash
if [ -d ~/.oh-my-fish ]
then
echo -e "\033[0;33mYou already have Oh My Fish installed.\033[0m You'll need to remove ~/.oh-my-fish if you want to install"
exit
fi
echo -e "\033[0;34mCloning Oh My Fish...\033[0m"
hash git >/dev/null && /usr/bin/env git clone https://github.com/bpinto/oh-my-fish.git ~/.oh-my-fish || {
echo -e "git not installed"
exit
}
echo -e "\033[0;34mLooking for an existing fish config...\033[0m"
if [ -f ~/.config/fish/config.fish ] || [ -h ~/.config/fish/config.fish ]
then
echo -e "\033[0;33mFound ~/.config/fish/config.fish.\033[0m \033[0;32mBacking up to ~/.config/fish/config.orig\033[0m";
mv ~/.config/fish/config.{fish,orig}
fi
echo -e "\033[0;34mUsing the Oh My Fish template file and adding it to ~/.config/fish/config.fish\033[0m"
cp ~/.oh-my-fish/templates/config.fish ~/.config/fish/config.fish
echo -e "\033[0;32m"' _ '"\033[0m"
echo -e "\033[0;32m"' | | '"\033[0m"
echo -e "\033[0;32m"' ___ | |__ _ __ ___ _ _ '"\033[0m"
echo -e "\033[0;32m"' / _ \| _ \ | _ ` _ \| | | | '"\033[0m"
echo -e "\033[0;32m"' | (_) | | | | | | | | | | |_| | '"\033[0m"
echo -e "\033[0;32m"' \___/|_| |_| |_| |_| |_|\__, | '"\033[0m"
echo -e "\033[0;32m"' __/ | '"\033[0m"
echo -e "\033[0;32m"' |___/ '"\033[0m"
echo -e "\033[0;32m"' '"\033[0m"
echo -e "\033[0;32m"' ___ '"\033[0m"
echo -e "\033[0;32m"' ___======____=---=) '"\033[0m"
echo -e "\033[0;32m"' /T \_--===) '"\033[0m"
echo -e "\033[0;32m"' [ \ (0) \~ \_-==) '"\033[0m"
echo -e "\033[0;32m"' \ / )J~~ \-=) '"\033[0m"
echo -e "\033[0;32m"' \\___/ )JJ~~~ \) '"\033[0m"
echo -e "\033[0;32m"' \_____/JJ~~~~~ \ '"\033[0m"
echo -e "\033[0;32m"' / \ , \J~~~~~ \ '"\033[0m"
echo -e "\033[0;32m"' (-\)\=|\\\~~~~ L__ '"\033[0m"
echo -e "\033[0;32m"' (\\) (\\\)_ \==__ '"\033[0m"
echo -e "\033[0;32m"' \V \\\) ===_____ \\\\\\ '"\033[0m"
echo -e "\033[0;32m"' \V) \_) \\\\JJ\J\) '"\033[0m"
echo -e "\033[0;32m"' /J\JT\JJJJ) '"\033[0m"
echo -e "\033[0;32m"' (JJJ| \UUU) '"\033[0m"
echo -e "\033[0;32m"' (UU) '"\033[0m"
echo -e "\n\n \033[0;32m....is now installed.\033[0m"
/usr/bin/env fish