2 # This file is deprecated. See README.
4 # This is the ZSH completion file for Twisted commands. It calls the current
5 # command-line with the special "--_shell-completion" option which is handled
6 # by twisted.python.usage. t.p.usage then generates zsh code on stdout to
7 # handle the completions for this particular command-line.
9 # 3rd parties that wish to provide zsh completion for commands that
10 # use t.p.usage may copy this file and change the first line to reference
11 # the name(s) of their command(s).
13 # This file is included in the official Zsh distribution as
14 # Completion/Unix/Command/_twisted
16 # redirect stderr to /dev/null otherwise deprecation warnings may get puked
17 # all over the user's terminal if completing options for mktap or other
18 # deprecated commands. Redirect stderr to a file to debug errors.
20 cmd=("$words[@]" --_shell-completion zsh:$CURRENT)
21 output=$("$cmd[@]" 2>/dev/null)
23 if [[ $output == "#compdef "* ]]; then
24 # Looks like we got a valid completion function - so eval it to produce
25 # the completion matches.
28 echo "\nCompletion error running command:" ${(qqq)cmd}
29 echo -n "If output below is unhelpful you may need to edit this file and "
30 echo "redirect stderr to a file."
31 echo "Expected completion function, but instead got:"