More tar *[cr]*f completion improvements.
This commit is contained in:
parent
0ae464e580
commit
f973eb043c
@ -3,12 +3,12 @@
|
||||
have tar && {
|
||||
_tar()
|
||||
{
|
||||
local cur prev words ext regex tar untar
|
||||
local cur prev words cword ext regex tar untar
|
||||
|
||||
COMPREPLY=()
|
||||
_get_comp_words_by_ref cur prev words
|
||||
_get_comp_words_by_ref cur prev words cword
|
||||
|
||||
if [ $COMP_CWORD -eq 1 ]; then
|
||||
if [ $cword -eq 1 ]; then
|
||||
COMPREPLY=( $( compgen -W 'c t x u r d A' -- "$cur" ) )
|
||||
return 0
|
||||
fi
|
||||
@ -19,15 +19,19 @@ _tar()
|
||||
--*)
|
||||
;;
|
||||
?(-)*[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
|
||||
if [[ $cword -eq 2 ]]; then
|
||||
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
|
||||
else
|
||||
_filedir
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
+([^IZzJjy])f)
|
||||
|
Loading…
x
Reference in New Issue
Block a user