1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-12 11:01:15 +02:00
zsh/Completion/User/_tar_archive
1999-08-19 11:18:05 +00:00

24 lines
696 B
Text

#autoload
# This is used to generate filenames usable as a tar archive. This may
# get one argument, a collection of tar option characters that may be
# used to find out what kind of filename is needed. If no argument is
# given but the parameter `_tar_cmd' is set, that is used.
# If your version of `tar' supports this you may want to complete
# things like `host:file' or `user@host:file' here.
local expl
[[ $# -eq 0 && $+_tar_cmd -ne 0 ]] && set "$_tar_cmd"
_description expl 'archive file'
if [[ "$1" = *[tx]* ]]; then
if [[ "$1" = *[zZ]* ]]; then
_files "$expl[@]" -g '*.((tar|TAR).(gz|GZ|Z)|.tgz)'
else
_files "$expl[@]" -g '*.(tar|TAR)'
fi
else
_files "$expl[@]"
fi