_tar(): eradicate use of compgen -G in favour of compgen -f -X

This commit is contained in:
ianmacd 2002-02-18 18:21:14 +00:00
parent 930f3a8cbd
commit 01d816ff59

View File

@ -1,6 +1,6 @@
# bash_completion - some programmable completion functions for bash 2.05a # bash_completion - some programmable completion functions for bash 2.05a
# #
# $Id: bash_completion,v 1.130 2002/02/18 19:07:37 ianmacd Exp $ # $Id: bash_completion,v 1.131 2002/02/18 19:21:14 ianmacd Exp $
# #
# Copyright (C) Ian Macdonald <ian@caliban.org> # Copyright (C) Ian Macdonald <ian@caliban.org>
# #
@ -1275,19 +1275,31 @@ _tar()
COMPREPLY=() COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]} cur=${COMP_WORDS[COMP_CWORD]}
if [[ ${COMP_WORDS[1]} == c*f ]]; then case "${COMP_WORDS[1]}" in
COMPREPLY=( $( compgen -f $cur ) ) c*f)
elif [[ ${COMP_WORDS[1]} == +([^zj])f ]]; then _filedir
COMPREPLY=( $( compgen -G $cur\*.tar ) ) ;;
elif [[ ${COMP_WORDS[1]} == *z*f ]]; then +([^zj])f)
COMPREPLY=( $( compgen -G $cur\*.t?(ar.)gz ) ) COMPREPLY=( $( compgen -d $cur ) \
elif [[ ${COMP_WORDS[1]} == *j*f ]]; then $( compgen -f -X '!*.tar' $cur ) )
COMPREPLY=( $( compgen -G $cur\*.tar.bz2 ) ) ;;
fi *z*f)
COMPREPLY=( $( compgen -d $cur ) \
$( compgen -f -X '!*.t?(ar.)gz' $cur ) )
;;
*j*f)
COMPREPLY=( $( compgen -d $cur ) \
$( compgen -f -X '!*.tar.bz2' $cur ) )
;;
*)
_filedir
;;
esac
return 0 return 0
} }
complete -F _tar -o default tar complete -F _tar -o filenames tar
# Linux iptables(8) completion # Linux iptables(8) completion
# #