blob: 626c528cde82ceadf72c76da9a46d4560fb9f470 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#compdef -P pydoc[0-9.]#
local curcontext=$curcontext state state_descr line ret=1
typeset -A opt_args
local -a args
args=(
'(- *)-k[search keyword]:keyword'
'(-k -g -w)-p[start web server on specified port]:port number'
'(-)-w[write out HTML in current directory]'
'(-)*: :->lookup'
)
if _pick_variant pydoc3='pydoc3 -b' pydoc2 -h; then
args+=( '(-k -w)-b[start server and open browser]' )
args+=( '(-k -w)-n[start web server with the given hostname]:hostname' )
else
args+=( '(- *)-g[start gui]' )
fi
_arguments -C : $args && return 0
case $state in
(lookup)
if [[ $words[CURRENT] = */* ]]; then
_files && ret=0
else
_alternative \
'keywords:keyword:compadd ${=${${(f)"$(_call_program keywords $words[1] keywords)"}[2,-1]}}' \
'topics:topic:compadd ${=${${(f)"$(_call_program topics $words[1] topics)"}[2,-1]}}' \
'modules:module:_python_modules' && ret=0
fi
esac
return ret
|