-
Notifications
You must be signed in to change notification settings - Fork 3
/
init.sh
40 lines (35 loc) · 844 Bytes
/
init.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# -*-Shell-script-*-
hcvswitch()
{
local VAULT="$1"
if [ -z "$VAULT" ] ; then
echo "invalid vault"
else
if [[ "$VAULT" == "none" ]] ; then
rm "${HOME}/.hcvaccount" &> /dev/null
eval "$("${HCVSWITCH_PATH}/hcvswitch.sh" eval)"
else
if ! grep -e "$VAULT" "$HCVSWITCH_CONFIG" &> /dev/null ; then
echo "invalid vault"
else
"${HCVSWITCH_PATH}/hcvswitch.sh" use "$VAULT" && eval "$("${HCVSWITCH_PATH}/hcvswitch.sh" eval)"
fi
fi
fi
}
hcvlist()
{
"${HCVSWITCH_PATH}/hcvswitch.sh" list
}
hcvversion()
{
cat "${HCVSWITCH_PATH}/version"
}
hcvauth()
{
"${HCVSWITCH_PATH}/hcvswitch.sh" auth
}
if [ -z "$HCVSWITCH_CONFIG" ] ; then
HCVSWITCH_CONFIG="${HOME}/.hcv.yml"
export HCVSWITCH_CONFIG
fi