Use git if it exists in install script

This commit is contained in:
Ceda EI 2019-05-15 13:25:33 +05:30
parent f1b966c5e0
commit 31ec315ffd
2 changed files with 12 additions and 8 deletions

View File

@ -1,11 +1,16 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if hash git; then
git clone https://gitlab.com/ceda_ei/wish.git $HOME/.config/wish.git
else
curl https://gitlab.com/ceda_ei/wish/-/archive/master/wish-master.tar -o /tmp/wish.tar curl https://gitlab.com/ceda_ei/wish/-/archive/master/wish-master.tar -o /tmp/wish.tar
mkdir $HOME/.config 2> /dev/null mkdir $HOME/.config 2> /dev/null
cd /tmp/ cd /tmp/
tar xf wish.tar tar xf wish.tar
mv wish-master/ wish/ mv wish-master/ wish/
mv wish/ $HOME/.config/ mv wish/ $HOME/.config/
fi
cat >> ~/.bashrc <<EOF cat >> ~/.bashrc <<EOF
# Wish # Wish
@ -14,4 +19,3 @@ WISH_PLUGINS=(exit_code_smiley bg_jobs date path newline vcs)
WISH_THEME=plain WISH_THEME=plain
source ~/.config/wish/wish.sh source ~/.config/wish/wish.sh
EOF EOF

View File

@ -15,7 +15,7 @@ function wish_vcs_set_colors() {
} }
function wish_vcs_main() { function wish_vcs_main() {
local op=$(git diff --numstat HEAD 2> /dev/null || echo -1) local op=$(git diff --numstat 2> /dev/null || echo -1)
if [[ $op != "-1" ]]; then if [[ $op != "-1" ]]; then
local git local git
git="$git $WISH_VCS_GIT_SYMBOL " git="$git $WISH_VCS_GIT_SYMBOL "