Skip to content

Commit 80266ae

Browse files
committed
update
1 parent 5af1048 commit 80266ae

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

kubectl_oadp_completion.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,19 @@ if ! complete -p kubectl &>/dev/null; then
1111
fi
1212

1313
if ! complete -p oc &>/dev/null; then
14-
# Check for oc in common locations
14+
# Check for oc in common locations, prioritizing ~/.local/bin
1515
oc_cmd=""
16-
if command -v oc &>/dev/null; then
17-
oc_cmd="oc"
18-
elif [[ -x "$HOME/.local/bin/oc" ]]; then
16+
if [[ -x "$HOME/.local/bin/oc" ]]; then
1917
oc_cmd="$HOME/.local/bin/oc"
18+
elif command -v oc &>/dev/null; then
19+
oc_cmd="oc"
2020
elif [[ -x "/usr/local/bin/oc" ]]; then
2121
oc_cmd="/usr/local/bin/oc"
2222
fi
2323

2424
if [[ -n "$oc_cmd" ]]; then
25-
source <($oc_cmd completion bash 2>/dev/null)
25+
# Load oc completion and ensure it gets registered
26+
eval "$($oc_cmd completion bash 2>/dev/null)"
2627
echo "Loaded oc completion from: $oc_cmd"
2728
fi
2829
fi

0 commit comments

Comments
 (0)