bootstrap: replace -n with -p (forces prompts); don't overwrite is new default

This commit is contained in:
Henrik Lissner 2016-12-17 03:11:16 -05:00
parent c44b17d393
commit ee5b105947

View file

@ -16,7 +16,7 @@
# -l Don't symlink dotfiles or bin scripts # -l Don't symlink dotfiles or bin scripts
# -d Do a dry run (only output commands, no changes) # -d Do a dry run (only output commands, no changes)
# -y Overwrite conflicts (no prompts) # -y Overwrite conflicts (no prompts)
# -n Don't overwrite conflicts (no prompts # -p Prompt on file conflict (to overwrite)
set -e set -e
source "$(cd $(dirname $0) && pwd -P)/shell/common.sh" source "$(cd $(dirname $0) && pwd -P)/shell/common.sh"
@ -55,10 +55,11 @@ _link() {
echo echo
fi fi
case $choice in case $choice in
y|Y) PREFIX="${red}OVERWRITE:${nc} " _run ln -svf "$1" "$2" y|Y) _run rm -rf "$2"
;; PREFIX="${red}OVERWRITE:${nc} " _run ln -svf "$1" "$2"
;;
*) PREFIX="${red}ABORTED:${nc} " DRYRUN=1 _run ln -svf "$1" "$2" *) PREFIX="${red}ABORTED:${nc} " DRYRUN=1 _run ln -svf "$1" "$2"
;; ;;
esac esac
else else
_run ln -svf "$1" "$2" _run ln -svf "$1" "$2"
@ -69,13 +70,13 @@ _link() {
install=1 install=1
link=1 link=1
update=1 update=1
yes= yes=0
while getopts iuldyn opt; do while getopts iuldyp opt; do
case $opt in case $opt in
d) DRYRUN=1 ;; d) DRYRUN=1 ;;
i) install= ;; i) install= ;;
l) link= ;; l) link= ;;
n) yes=0 ;; p) yes= ;;
u) update= ;; u) update= ;;
y) yes=1 ;; y) yes=1 ;;
*) >&2 echo "Aborted." *) >&2 echo "Aborted."