
_test_payload_esad(){
	local OPTS='--help -h --device -d --vid --pid --baudrate -b --parity --stopbits --flowcontrol --chan-arm --chan-trig --elrs-pipe'
	COMPREPLY=()
	local prev="${COMP_WORDS[COMP_CWORD-1]}"
	case "$prev" in
		-d|--device)
			COMPREPLY=( $(compgen -f -- "${COMP_WORDS[COMP_CWORD]}") )
			return 0
			;;
		--parity)
			COMPREPLY=( $(compgen -W 'none even odd' -- "${COMP_WORDS[COMP_CWORD]}") )
			return 0
			;;
		--stopbits)
			COMPREPLY=( $(compgen -W '1 2' -- "${COMP_WORDS[COMP_CWORD]}") )
			return 0
			;;
		--flowcontrol)
			COMPREPLY=( $(compgen -W 'none rts/cts xon/xoff' -- "${COMP_WORDS[COMP_CWORD]}") )
			return 0
			;;
		--vid|--pid|-b|--baudrate|--chan-arm|--chan-trig|--elrs-pipe)
			return 0
			;;
	esac
	COMPREPLY=( $(compgen -W "${OPTS}" -- "${COMP_WORDS[COMP_CWORD]}") )
}

complete -F _test_payload_esad test_payload_esad
