#compdef authcli certtool sacli confdba dbcvt dnscli iosvod liman logdba mandeb sa sacli signtool userdba
#
# This is the ZSH completion file for Access Server commands.  
# current
#
# This file is adapted from the official twisted zsh completion file and
# works in the same way as Completion/Unix/Command/_twisted

# redirect stderr to /dev/null otherwise deprecation warnings may get puked all
# over the user's terminal if completing options for a deprecated command.
# Redirect stderr to a file to debug errors.
local cmd output
cmd=("$words[@]" --_shell-completion zsh:$CURRENT)
output=$("$cmd[@]" 2>/dev/null)

if [[ $output == "#compdef "* ]]; then
    # Looks like we got a valid completion function - so eval it to produce
    # the completion matches.
    eval $output
else
    echo "\nCompletion error running command:" ${(qqq)cmd}
    echo -n "If output below is unhelpful you may need to edit this file and "
    echo    "redirect stderr to a file."
    echo "Expected completion function, but instead got:" 
    echo $output
    return 1
fi
