Improve tar *[cr]*f completions (Debian: #618734).

This commit is contained in:
Ville Skyttä 2011-03-20 18:22:21 +02:00
parent 4f4c7f2d1f
commit 0ae464e580

View File

@ -13,13 +13,25 @@ _tar()
return 0 return 0
fi fi
local tars='@(@(tar|gem|spkg)?(.@(Z|[gx]z|bz?(2)|lzma))|t@([glx]z|bz?(2)))'
case ${words[1]} in case ${words[1]} in
?(-)[cr]*f) --*)
_filedir ;;
?(-)*[cr]*f)
ext='@(tar|gem|spkg)'
case ${words[1]} in
*a*) ext="$tars" ;;
*z*) ext='t?(ar.)gz' ;;
*Z*) ext='tar.Z' ;;
*[jy]*) ext='t?(ar.)bz?(2)' ;;
*J*) ext='t?(ar.)xz' ;;
esac
_filedir $ext
return 0 return 0
;; ;;
+([^IZzJjy])f) +([^IZzJjy])f)
ext='@(@(tar|gem|spkg)?(.@(Z|[gx]z|bz?(2)|lzma))|t@([glx]z|bz?(2)))' ext="$tars"
regex='\(\(tar\|gem\|spkg\)\(\.\(Z\|[gx]z\|bz2\?\|lzma\)\)\?\|t\([glx]z\|bz2\?\)\)' regex='\(\(tar\|gem\|spkg\)\(\.\(Z\|[gx]z\|bz2\?\|lzma\)\)\?\|t\([glx]z\|bz2\?\)\)'
;; ;;
*[Zz]*f) *[Zz]*f)