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 <TAB> 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.
This commit is contained in:
parent
8b5e5d1af5
commit
63f4f1e61b
|
@ -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
|
||||
;;
|
||||
|
|
Loading…
Reference in New Issue