Skip to content

Commit c44dcc0

Browse files
committed
fix: 'init' error of completion directory not found
1 parent e406aa1 commit c44dcc0

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

pkg/lib/commands/do-init.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@ do-init() {
4848
echo_posix_shell_variables
4949
cat <<-"EOF"
5050
# bpm packages completions
51-
for f in "$BPM_ROOT"/cellar/completions/bash/?*.{sh,bash}; do
52-
source "$f"
53-
done
54-
unset f
51+
if [ -d "$BPM_ROOT/cellar/completions/bash" ]; then
52+
for f in "$BPM_ROOT"/cellar/completions/bash/?*.{sh,bash}; do
53+
source "$f"
54+
done
55+
unset f
56+
fi
5557
5658
EOF
5759
;;
@@ -60,10 +62,12 @@ do-init() {
6062
cat <<-"EOF"
6163
# bpm packages completions
6264
fpath=("$BPM_ROOT/cellar/completions/zsh/compsys" $fpath)
63-
for f in "$BPM_ROOT"/cellar/completions/zsh/compctl/?*.zsh; do
64-
source "$f"
65-
done
66-
unset f
65+
if [ -d "$BPM_ROOT/cellar/completions/zsh/compctl" ]; then
66+
for f in "$BPM_ROOT"/cellar/completions/zsh/compctl/?*.zsh; do
67+
source "$f"
68+
done
69+
unset f
70+
fi
6771
6872
EOF
6973
;;

0 commit comments

Comments
 (0)