From ee5b105947ccb6e3a2ec77b9b998123c1abb274e Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 17 Dec 2016 03:11:16 -0500 Subject: [PATCH] bootstrap: replace -n with -p (forces prompts); don't overwrite is new default --- bootstrap | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/bootstrap b/bootstrap index 8c2b016e..896fe89a 100755 --- a/bootstrap +++ b/bootstrap @@ -16,7 +16,7 @@ # -l Don't symlink dotfiles or bin scripts # -d Do a dry run (only output commands, no changes) # -y Overwrite conflicts (no prompts) -# -n Don't overwrite conflicts (no prompts +# -p Prompt on file conflict (to overwrite) set -e source "$(cd $(dirname $0) && pwd -P)/shell/common.sh" @@ -55,10 +55,11 @@ _link() { echo fi 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" - ;; + ;; esac else _run ln -svf "$1" "$2" @@ -69,13 +70,13 @@ _link() { install=1 link=1 update=1 -yes= -while getopts iuldyn opt; do +yes=0 +while getopts iuldyp opt; do case $opt in d) DRYRUN=1 ;; i) install= ;; l) link= ;; - n) yes=0 ;; + p) yes= ;; u) update= ;; y) yes=1 ;; *) >&2 echo "Aborted."