@@ -11,19 +11,18 @@ export GREP_COLOR="never"
11
11
# on Windows where helm returns a Windows path but we
12
12
# need a Unix path
13
13
14
- if type cygpath > /dev/null 2>&1 ; then
14
+ if command -v cygpath > /dev/null 2>&1 ; then
15
15
HELM_BIN=" $( cygpath -u " ${HELM_BIN} " ) "
16
16
HELM_PLUGIN_DIR=" $( cygpath -u " ${HELM_PLUGIN_DIR} " ) "
17
17
fi
18
18
19
19
[ -z " $HELM_BIN " ] && HELM_BIN=$( command -v helm)
20
- HELM_MAJOR_VERSION=$( " ${HELM_BIN} " version --client --short | awk -F ' .' ' {print $1}' )
21
20
22
21
[ -z " $HELM_HOME " ] && HELM_HOME=$( helm env | grep ' HELM_DATA_HOME' | cut -d ' =' -f2 | tr -d ' "' )
23
22
24
23
mkdir -p " $HELM_HOME "
25
24
26
- : ${HELM_PLUGIN_DIR:= " $HELM_HOME /plugins/helm-diff" }
25
+ : " ${HELM_PLUGIN_DIR:= " $HELM_HOME /plugins/helm-diff" } "
27
26
28
27
if [ " $SKIP_BIN_INSTALL " = " 1" ]; then
29
28
echo " Skipping binary install"
@@ -73,7 +72,9 @@ verifySupported() {
73
72
exit 1
74
73
fi
75
74
76
- if ! type " curl" > /dev/null && ! type " wget" > /dev/null; then
75
+ if
76
+ ! command -v curl > /dev/null 2>&1 && ! command -v wget > /dev/null 2>&1
77
+ then
77
78
echo " Either curl or wget is required"
78
79
exit 1
79
80
fi
@@ -82,7 +83,7 @@ verifySupported() {
82
83
# getDownloadURL checks the latest available version.
83
84
getDownloadURL () {
84
85
version=$( git -C " $HELM_PLUGIN_DIR " describe --tags --exact-match 2> /dev/null || :)
85
- if [ " $SCRIPT_MODE " = " install" -a -n " $version " ]; then
86
+ if [ " $SCRIPT_MODE " = " install" ] && [ -n " $version " ]; then
86
87
DOWNLOAD_URL=" https://github.com/$PROJECT_GH /releases/download/$version /helm-diff-$OS -$ARCH .tgz"
87
88
else
88
89
DOWNLOAD_URL=" https://github.com/$PROJECT_GH /releases/latest/download/helm-diff-$OS -$ARCH .tgz"
@@ -104,9 +105,13 @@ rmTempDir() {
104
105
downloadFile () {
105
106
PLUGIN_TMP_FILE=" ${HELM_TMP} /${PROJECT_NAME} .tgz"
106
107
echo " Downloading $DOWNLOAD_URL "
107
- if type " curl" > /dev/null; then
108
+ if
109
+ command -v curl > /dev/null 2>&1
110
+ then
108
111
curl -L " $DOWNLOAD_URL " -o " $PLUGIN_TMP_FILE "
109
- elif type " wget" > /dev/null; then
112
+ elif
113
+ command -v wget > /dev/null 2>&1
114
+ then
110
115
wget -q -O " $PLUGIN_TMP_FILE " " $DOWNLOAD_URL "
111
116
fi
112
117
}
0 commit comments