# vi: ft=bash

_tofi()
{
	local cur prev words cword
	_init_completion || return

	words=(
		--help
		--config
		--include
		--output
		--scale
		--anchor
		--background-color
		--corner-radius
		--font
		--font-size
		--font-features
		--font-variations
		--num-results
		--selection-color
		--selection-match-color
		--selection-background
		--selection-background-padding
		--selection-background-corner-radius
		--outline-width
		--outline-color
		--prompt-text
		--prompt-padding
		--prompt-color
		--prompt-background
		--prompt-background-padding
		--prompt-background-corner-radius
		--placeholder-text
		--placeholder-color
		--placeholder-background
		--placeholder-background-padding
		--placeholder-background-corner-radius
		--input-color
		--input-background
		--input-background-padding
		--input-background-corner-radius
		--default-result-color
		--default-result-background
		--default-result-background-padding
		--default-result-background-corner-radius
		--alternate-result-color
		--alternate-result-background
		--alternate-result-background-padding
		--alternate-result-background-corner-radius
		--result-spacing
		--min-input-width
		--border-width
		--border-color
		--text-color
		--width
		--height
		--exclusive-zone
		--margin-top
		--margin-bottom
		--margin-left
		--margin-right
		--padding-top
		--padding-bottom
		--padding-left
		--padding-right
		--clip-to-padding
		--horizontal
		--hide-cursor
		--history
		--history-file
		--fuzzy-match
		--require-match
		--hide-input
		--hidden-character
		--drun-launch
		--terminal
		--hint-font
		--late-keyboard-init
		--multi-instance
		--ascii-input
     )

	case "${prev}" in
		--font)
			;&
		--history-file)
			;&
		--include)
			;&
		--config|-c)
			_filedir
			return 0
			;;
		--help|-h)
			;;
		--*)
			return 0
			;;
	esac
	case "${cur}" in
		-[ch])
			COMPREPLY=($cur)
			;;
		*)
			COMPREPLY=($(compgen -W "${words[*]}" -- ${cur}))
			return 0
			;;
	esac
}
complete -F _tofi tofi
complete -F _tofi tofi-run
complete -F _tofi tofi-drun
