From 63f4f1e61b2fc1e5b8b285f071ee963a696b1271 Mon Sep 17 00:00:00 2001 From: mdirik Date: Tue, 23 Dec 2014 14:24:38 +0200 Subject: [PATCH] Make completion.sh respect VAGRANT_HOME When VAGRANT_HOME is set to a different path than $HOME/.vagrant.d, bash completions regarding box names fails with an error like: "$ vagrant init find: `/home/mert/.vagrant.d/boxes': No such file or directory" This commit makes completion.sh respect VAGRANT_HOME if it is set. It will continue to use $HOME/.vagrant.d otherwise. --- contrib/bash/completion.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/bash/completion.sh b/contrib/bash/completion.sh index 636795744..e21dc8dcf 100644 --- a/contrib/bash/completion.sh +++ b/contrib/bash/completion.sh @@ -65,7 +65,7 @@ _vagrant() { then case "$prev" in "init") - local box_list=$(find $HOME/.vagrant.d/boxes -mindepth 1 -maxdepth 1 -type d -exec basename {} \;) + local box_list=$(find "${VAGRANT_HOME:-${HOME}/.vagrant.d}/boxes" -mindepth 1 -maxdepth 1 -type d -exec basename {} \;) COMPREPLY=($(compgen -W "${box_list}" -- ${cur})) return 0 ;; @@ -111,7 +111,7 @@ _vagrant() { then case "$prev" in "remove"|"repackage") - local box_list=$(find $HOME/.vagrant.d/boxes -mindepth 1 -maxdepth 1 -type d -exec basename {} \;) + local box_list=$(find "${VAGRANT_HOME:-${HOME}/.vagrant.d}/boxes" -mindepth 1 -maxdepth 1 -type d -exec basename {} \;) COMPREPLY=($(compgen -W "${box_list}" -- ${cur})) return 0 ;;