
# Copyright 2019 California Institute of Technology.

# You should have received a copy of the licensing terms for this
# software included in the file “LICENSE” located in the top-level
# directory of this package. If you did not, you can view a copy at
# http://dcc.ligo.org/M1500244/LICENSE.txt

_ligo_epics_channel_completion()
{
	local cur
	cur="${COMP_WORDS[COMP_CWORD]}"

	# see https://stackoverflow.com/questions/10528695/how-to-reset-comp-wordbreaks-without-affecting-other-completion-script/12495480#12495480
	_get_comp_words_by_ref -n : cur

	COMPREPLY=( $(/usr/lib/ligo_channel_completion "${cur}" -d "${EPICS_CHAN_LIST}") )

	__ltrim_colon_completions "$cur"

	return 0
}

complete -F _ligo_epics_channel_completion cdsutils
complete -F _ligo_epics_channel_completion caget
complete -F _ligo_epics_channel_completion caput
complete -F _ligo_epics_channel_completion camonitor
complete -F _ligo_epics_channel_completion probe
