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