Blob Blame History Raw
# bash completion for lzop(1)                                        -*- sh -*-
#
have lzop &&
_lzop()
{
	local cur prev xspec IFS=$' \t\n'

	COMPREPLY=()
	cur=`_get_cword`
	prev=${COMP_WORDS[COMP_CWORD-1]}

	if [[ "$cur" == -* ]]; then
		COMPREPLY=( $( compgen -W '-d -x -l -I -t -V -h -L -q -v -c \
			-o -p -f -n -N -P -S -U	-1 -2 -3 -4 -5 -6 -7 -8 -9 \
			--fast --best --decompress --uncompress --extract \
			--test --list --ls --info --sysinfo --license --help \
			--version --stdout --output --path --force --no-name \
			--no-checksum --name --no-mode --no-time --suffix \
			--keep --unlink --delete --crc32 --no-warn --quiet \
			--silent --ignore-warn --verbose --no-stdin --filter \
			--checksum --no-color --mono --color' -- $cur ) )
		return 0
	fi

	xspec="*.?(t)lzo"
	if [[ "$prev" == --* ]]; then
		[[ "$prev" == --@(de|un)compress || \
			"$prev" == --list || \
			"$prev" == --test ]] && xspec="!"$xspec
		[[ "$prev" == --force ]] && xspec=
	elif [[ "$prev" == -* ]]; then
		[[ "$prev" == -*[dlt]* ]] && xspec="!"$xspec
		[[ "$prev" == -*f* ]] && xspec=
	elif [ "$prev" = '>' ]; then
		xspec=
	fi

	_expand || return 0

	COMPREPLY=( $( compgen -f -X "$xspec" -- $cur ) \
		    $( compgen -d -- $cur ) )
} &&
complete -F _lzop $filenames lzop