mirror of
https://github.com/Steffo99/config-fish.git
synced 2024-12-22 06:44:22 +00:00
Update once again dotfish
This commit is contained in:
parent
0f18d2899d
commit
b6202a3f67
3 changed files with 30 additions and 5 deletions
0
.DOTFISHED
Normal file
0
.DOTFISHED
Normal file
13
functions/confirm.fish
Normal file
13
functions/confirm.fish
Normal 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
|
|
@ -9,8 +9,8 @@ function dotfish
|
||||||
echo_highlight "$TARGET" \n
|
echo_highlight "$TARGET" \n
|
||||||
|
|
||||||
if test -z $TARGET
|
if test -z $TARGET
|
||||||
echo_progress "Invalid target, exiting with 1"
|
echo_progress "Couldn't detect target, exiting..." \n
|
||||||
exit 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
set -g FISHCONFIG ~(echo $TARGET)/.config/fish
|
set -g FISHCONFIG ~(echo $TARGET)/.config/fish
|
||||||
|
@ -18,16 +18,28 @@ function dotfish
|
||||||
echo_progress "Destination directory is: "
|
echo_progress "Destination directory is: "
|
||||||
echo_highlight "$FISHCONFIG" \n
|
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
|
if test -d $FISHCONFIG
|
||||||
echo_progress "Pulling from Git..." \n
|
echo_progress "Existing config detected, pulling from Git..." \n
|
||||||
git -C $FISHCONFIG pull
|
git -C $FISHCONFIG pull
|
||||||
else
|
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
|
git clone "https://github.com/Steffo99/.config-fish" $FISHCONFIG
|
||||||
end
|
end
|
||||||
|
|
||||||
echo_progress "Fixing permissions..." \n
|
echo_progress "Fixing permissions..." \n
|
||||||
chown -R "$TARGET:" $FISHCONFIG
|
chown -R "$TARGET:" $FISHCONFIG
|
||||||
|
|
||||||
echo_progress "Update complete!"
|
echo_progress "Update complete!" \n
|
||||||
end
|
end
|
Loading…
Reference in a new issue