summaryrefslogtreecommitdiff
path: root/install/util.fish
diff options
context:
space:
mode:
Diffstat (limited to 'install/util.fish')
-rw-r--r--install/util.fish10
1 files changed, 10 insertions, 0 deletions
diff --git a/install/util.fish b/install/util.fish
index 1d1a6ec..e5dd7f8 100644
--- a/install/util.fish
+++ b/install/util.fish
@@ -116,3 +116,13 @@ function install-link -a from to
ln -s $from $to
end
end
+
+function confirm-copy -a from to
+ test -L $to -a "$(realpath $to 2> /dev/null)" = (realpath $from) && return # Return if symlink
+ cmp $from $to &> /dev/null && return # Return if files are the same
+ if test -e $to
+ read -l -p "input '$(realpath $to) already exists. Overwrite? [y/N] ' -n" confirm
+ test "$confirm" = 'y' -o "$confirm" = 'Y' && log 'Continuing.' || return
+ end
+ cp $from $to
+end