Skip to content

Commit c9e671f

Browse files
committed
add completion dir to fpath
1 parent f20967b commit c9e671f

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

kubectx.plugin.zsh

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,15 @@
44
# oh-my-zsh compatible plugins.
55

66
KUBECTX_DIR="$(dirname $0)/kubectx"
7-
OH_MY_ZSH_DIR="$(dirname $0)/../../.."
7+
COMPLETION_DIR="${KUBECTX_DIR}/completion"
88
export PATH=${PATH}:${KUBECTX_DIR}
99

10-
if [[ ! -f "${KUBECTX_DIR}/completion/kubectx.zsh" ]]; then
10+
if [[ ! -f "${COMPLETION_DIR}/kubectx.zsh" ]]; then
1111
pushd "$KUBECTX_DIR"
1212
git submodule init
1313
git submodule update
1414
popd
1515
fi
1616

17-
function loadCompletions()
18-
{
19-
COMPLETION_DIR="${OH_MY_ZSH_DIR}/completions"
20-
if [ ! -d ${COMPLETION_DIR} ]; then # Check if completion directory exists
21-
mkdir -p ${COMPLETION_DIR}
22-
chmod -R 755 ${COMPLETION_DIR}
23-
fi
24-
ZSH_COMPLETION_FILE="${COMPLETION_DIR}/_kubectx.zsh"
25-
if [ ! -f ${ZSH_COMPLETION_FILE} ]; then # Check if zsh completion file exists
26-
ln -s ${KUBECTX_DIR}/completion/kubectx.zsh ${ZSH_COMPLETION_FILE}
27-
ln -s ${KUBECTX_DIR}/completion/kubens.zsh ${COMPLETION_DIR}/_kubens.zsh
28-
fi
29-
}
30-
3117
# Load completions
32-
loadCompletions
18+
fpath=($COMPLETION_DIR $fpath)

0 commit comments

Comments
 (0)