2011-11-01 22:14:45 +02:00
|
|
|
# bash completion for gzip -*- shell-script -*-
|
2009-05-17 22:01:43 +02:00
|
|
|
|
|
|
|
_gzip()
|
|
|
|
{
|
2011-04-20 17:02:27 +03:00
|
|
|
local cur prev words cword
|
|
|
|
_init_completion || return
|
2010-01-18 20:32:03 +02:00
|
|
|
|
|
|
|
case $prev in
|
|
|
|
-b|--blocksize|-p|--processes|-S|--suffix|-h|--help|-V|--version)
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
2009-10-04 19:42:50 +02:00
|
|
|
|
|
|
|
if [[ "$cur" == -* ]]; then
|
2011-04-27 22:22:49 +03:00
|
|
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) {-1..-9}' \
|
2010-01-18 20:32:03 +02:00
|
|
|
-- "$cur" ) )
|
2011-05-02 11:41:52 +03:00
|
|
|
[[ $COMPREPLY == *= ]] && compopt -o nospace
|
2009-10-04 19:42:50 +02:00
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
2011-04-20 17:02:27 +03:00
|
|
|
local IFS=$'\n' xspec="*.@(gz|t[ag]z)"
|
2009-10-04 19:42:50 +02:00
|
|
|
|
|
|
|
if [[ "$prev" == --* ]]; then
|
|
|
|
[[ "$prev" == --decompress || \
|
|
|
|
"$prev" == --list || \
|
|
|
|
"$prev" == --test ]] && xspec="!"$xspec
|
|
|
|
[[ "$prev" == --force ]] && xspec=
|
|
|
|
elif [[ "$prev" == -* ]]; then
|
|
|
|
[[ "$prev" == -*[dlt]* ]] && xspec="!"$xspec
|
|
|
|
[[ "$prev" == -*f* ]] && xspec=
|
|
|
|
fi
|
|
|
|
|
|
|
|
_expand || return 0
|
|
|
|
|
2011-04-21 12:33:05 +03:00
|
|
|
compopt -o filenames
|
2009-10-04 19:42:50 +02:00
|
|
|
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
|
|
|
|
$( compgen -d -- "$cur" ) )
|
2009-05-17 22:01:43 +02:00
|
|
|
} &&
|
2010-11-01 19:26:53 +02:00
|
|
|
complete -F _gzip gzip pigz
|
2009-10-01 20:54:51 +03:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
# ex: ts=4 sw=4 et filetype=sh
|