
_voxl_led(){

	local OPTS=('on off color custom')
	local COLORS=('white red orange yellow green teal blue purple')

	COMPREPLY=()

	if [ "$COMP_CWORD" -eq 1 ]; then
        COMPREPLY=( $(compgen -W '${OPTS}' -- ${COMP_WORDS[COMP_CWORD]}) )
        return 0
	fi

	if [ "$COMP_CWORD" -eq 2 ]; then
		case ${COMP_WORDS[COMP_CWORD-1]} in
			"color")
		        COMPREPLY=( $(compgen -W '${COLORS}' -- ${COMP_WORDS[COMP_CWORD]}) )
		        return 0
				;;
		esac
		return 0
	fi

	if [ -p /run/mpa/cpu_monitor/control ]; then
		if [[ "$COMP_CWORD" -eq 3 && "${COMP_WORDS[1]}" -eq "color" ]] ||
	       [[ "$COMP_CWORD" -eq 5 && "${COMP_WORDS[1]}" -eq "custom" ]]; then
	        COMPREPLY=( $(compgen -W 'flash' -- ${COMP_WORDS[COMP_CWORD]}) )
	    fi
    fi

}

complete -F _voxl_led voxl-led