1
Fork 0
mirror of https://github.com/Steffo99/config-fish.git synced 2024-12-21 22:34:23 +00:00

Update once again dotfish

This commit is contained in:
Steffo 2021-07-15 02:49:45 +02:00
parent 0f18d2899d
commit b6202a3f67
Signed by: steffo
GPG key ID: 6965406171929D01
3 changed files with 30 additions and 5 deletions

0
.DOTFISHED Normal file
View file

13
functions/confirm.fish Normal file
View file

@ -0,0 +1,13 @@
function confirm
set -g ANSWER (read -n 1 -P "Confirm? (y/N) ")
if test -z $ANSWER
return 1
else if test $ANSWER = "y"
return 0
else if test $ANSWER = "Y"
return 0
else
return 1
end
end

View file

@ -9,8 +9,8 @@ function dotfish
echo_highlight "$TARGET" \n
if test -z $TARGET
echo_progress "Invalid target, exiting with 1"
exit 1
echo_progress "Couldn't detect target, exiting..." \n
return 1
end
set -g FISHCONFIG ~(echo $TARGET)/.config/fish
@ -18,16 +18,28 @@ function dotfish
echo_progress "Destination directory is: "
echo_highlight "$FISHCONFIG" \n
if not test -e "$FISHCONFIG/.DOTFISHED"
echo_progress "Conflicting config detected, confirm deletion?" \n
if confirm
echo_progress "Deleting old config..." \n
rm -rf $FISHCONFIG
else
echo_progress "Deletion was refused, exiting..." \n
return 2
end
end
if test -d $FISHCONFIG
echo_progress "Pulling from Git..." \n
echo_progress "Existing config detected, pulling from Git..." \n
git -C $FISHCONFIG pull
else
echo_progress "Cloning from Git..." \n
echo_progress "No config detected, cloning from Git..." \n
git clone "https://github.com/Steffo99/.config-fish" $FISHCONFIG
end
echo_progress "Fixing permissions..." \n
chown -R "$TARGET:" $FISHCONFIG
echo_progress "Update complete!"
echo_progress "Update complete!" \n
end