# bash completion for dnstool                                  -*- shell-script -*-

_dnstool()
{
  local cur prev hosts spn_classes
  COMPREPLY=()
  cur="${COMP_WORDS[COMP_CWORD]}"
  prev="${COMP_WORDS[COMP_CWORD - 1]}"
  hosts=$(compgen -A hostname | grep -vE '^(localhost|parrot|ip6-localhost|ip6-loopback|ip6-allnodes|ip6-allrouters|ff02::1|ff02::2|::1|)$')

  if [[ $cur == -* ]]; then
    opts="$(_parse_usage dnstool) $(_parse_help dnstool --help)"
    COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
  fi

  if [[ "$prev" == "-a" || "$prev" == "--action" ]]; then
    COMPREPLY=( $(compgen -W "add modify query remove resurrect ldapdelete" -- "$cur") )
  fi

}

complete -o bashdefault -o default -F _dnstool dnstool

# ex: filetype=sh

