Skip to content

Commit adb975b

Browse files
committed
Move setting of variables to outside function call
1 parent acc05d6 commit adb975b

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

vb.sh

+22-21
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,6 @@ vb() {
88
local cmd="$1"
99
local subcmd="$2"
1010

11-
[[ -f $HOME/.vbrc ]] && source $HOME/.vbrc
12-
13-
if [[ -n $VB_CACHE ]]; then
14-
if [[ -d $VB_CACHE || $VB_CACHE == */ ]]; then
15-
VB_CACHE=$VB_CACHE/vb.cache
16-
fi
17-
else
18-
VB_CACHE="${ZSH_CACHE_DIR:-"$HOME/.cache/vb"}/vb.cache"
19-
fi
20-
21-
[[ -d ${VB_CACHE%/*} ]] || mkdir -p ${VB_CACHE%/*}
22-
23-
if ${VB_COLOR:=true}; then
24-
: ${VB_ERROR_COLOR:='\e[0;91m'}
25-
: ${VB_SUCCESS_COLOR:='\e[0;92m'}
26-
: ${VB_WARNING_COLOR:='\e[0;93m'}
27-
VB_RESET='\e[0m'
28-
else
29-
unset VB_ERROR_COLOR VB_SUCCESS_COLOR VB_WARNING_COLOR VB_RESET
30-
fi
31-
3211
if [[ -f $VB_CACHE ]]; then
3312
current_box="$( < $VB_CACHE)"
3413
else
@@ -166,3 +145,25 @@ __vb_vagrant_args() {
166145
printf "list\nuse\nswitch\ncd\necho\n"
167146
vagrant -h | "grep" -E "^\s+" | awk '{print $1}' | tr -d ','
168147
}
148+
149+
[[ -f $HOME/.vbrc ]] && source $HOME/.vbrc
150+
151+
if [[ -n $VB_CACHE ]]; then
152+
if [[ -d $VB_CACHE || $VB_CACHE == */ ]]; then
153+
VB_CACHE=$VB_CACHE/vb.cache
154+
fi
155+
else
156+
VB_CACHE="${ZSH_CACHE_DIR:-"$HOME/.cache/vb"}/vb.cache"
157+
fi
158+
159+
[[ -d ${VB_CACHE%/*} ]] || mkdir -p ${VB_CACHE%/*}
160+
161+
if ${VB_COLOR:=true}; then
162+
: ${VB_ERROR_COLOR:='\e[0;91m'}
163+
: ${VB_SUCCESS_COLOR:='\e[0;92m'}
164+
: ${VB_WARNING_COLOR:='\e[0;93m'}
165+
VB_RESET='\e[0m'
166+
else
167+
unset VB_ERROR_COLOR VB_SUCCESS_COLOR VB_WARNING_COLOR VB_RESET
168+
fi
169+

0 commit comments

Comments
 (0)