__unar()
{
	local cur prev opts
	COMPREPLY=()
	cur="${COMP_WORDS[COMP_CWORD]}"
	prev="${COMP_WORDS[COMP_CWORD-1]}"
	opts="--output-directory --force-overwrite --force-rename --force-skip \
		--force-directory --no-directory --password --encoding \
		--password-encoding --indexes --no-recursion --copy-time \
		--no-quarantine --forks --quiet --help --version"
	if [[ ${prev} == "--forks" ]] ; then
		local forksopts
		forksopts="fork visible hidden skip"
		COMPREPLY=( $(compgen -W "${forksopts}" -- ${cur}) )
		return 0
	elif [[ ${cur} == -* ]] ; then
		COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
		return 0
	fi
}

complete -o bashdefault -A file -F __unar  unar

