# Copyright (c) 2021 David Steele <dsteele@gmail.com>
#
# SPDX-License-Identifier: GPL-2.0-or-later
# License-Filename: LICENSE

_tdt_completions()
{
  local candidates

  if [ "$3" = "-f" ] ; then
	COMPREPLY=($(compgen -A file $2))
  else
	candidates=("$(project -l "$2")")
	COMPREPLY=($(compgen -W "$candidates" $2))
  fi
}

complete -F _tdt_completions project
complete -F _tdt_completions listtodo
