Skip to content

Commit 017fb55

Browse files
committed
fix(__load_completion): do not warn when completing . first time
ca361be enables warnings about trying to source directories when loading completions. That's useful, but triggers the errors in the common case of trying to source something, `. <TAB>`. Special case `.` (and for completeness, even though not that interesting, `..`) so we don't issue the warning about them. Closes scop#703
1 parent 36ceb27 commit 017fb55

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

bash_completion

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2560,7 +2560,9 @@ __load_completion()
25602560
compfile="$dir/$compfile"
25612561
# Avoid trying to source dirs; https://bugzilla.redhat.com/903540
25622562
if [[ -d $compfile ]]; then
2563-
echo "bash_completion: $compfile: is a directory" >&2
2563+
# Do not warn with . or .. (especially the former is common)
2564+
[[ $compfile == */.?(.) ]] ||
2565+
echo "bash_completion: $compfile: is a directory" >&2
25642566
elif [[ -e $compfile ]] && . "$compfile"; then
25652567
[[ $backslash ]] && $(complete -p "$cmd") "\\$cmd"
25662568
return 0

0 commit comments

Comments
 (0)