summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-01-04 14:29:42 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-01-04 14:29:42 +0900
commitf9f9b671c5dda3a88b515e9a5e9f9cbf292b849b (patch)
tree9d4226f79132910dd0203f289e08fc10ba786ac3 /install
parent606d33e77e6e6aa2f03c4886db781260caff3a34 (diff)
Ask if fzf executable already exists
Diffstat (limited to 'install')
-rwxr-xr-xinstall17
1 files changed, 11 insertions, 6 deletions
diff --git a/install b/install
index 46f65537..8ea14359 100755
--- a/install
+++ b/install
@@ -5,8 +5,17 @@ fzf_base=`pwd`
ARCHI=$(uname -sm)
+ask() {
+ read -p "$1 ([y]/n) " -n 1 -r
+ echo
+ [[ ! $REPLY =~ ^[Nn]$ ]]
+}
+
download() {
echo "Downloading fzf executable ($1) ..."
+ if [ -x "$fzf_base"/bin/fzf ]; then
+ ask "- fzf already exists. Download it again?" || return 0
+ fi
mkdir -p "$fzf_base"/bin && cd "$fzf_base"/bin
if [ $? -ne 0 ]; then
echo "- Failed to create bin directory."
@@ -108,15 +117,11 @@ if [ $downloaded -ne 1 ]; then
fi
# Auto-completion
-read -p "Do you want to add auto-completion support? ([y]/n) " -n 1 -r
-echo
-[[ ! $REPLY =~ ^[Nn]$ ]]
+ask "Do you want to add auto-completion support?"
auto_completion=$?
# Key-bindings
-read -p "Do you want to add key bindings? ([y]/n) " -n 1 -r
-echo
-[[ ! $REPLY =~ ^[Nn]$ ]]
+ask "Do you want to add key bindings?"
key_bindings=$?
echo