Debian Codegraph @

misc/completions/zsh/_cppman

raw
1 #compdef cppman
2 _cppman_pages ()
3 {
4 P=${words[1]}
5 if [ $CURRENT -gt $NORMARG ]; then
6 return
7 fi
8 W=${words[$NORMARG]}
9 if [ -z "$W" ]; then
10 return
11 fi
12 # (f)$(...) use shell output as arrays with line breaks as separators
13 # ${...%% *} remove everything after the first space in each array element
14 # ${(M)...:#$W*} only keep elements that match $W*, i.e. start with $W
15 params=(${(M)${${(f)"$($P -f $W)"}%% *}:#$W*})
16
17 compadd "$@" -- $params
18 }
19
20 # (1 -) don't suggest any further after an option. Used because the code does sys.exit() after these.
21 _arguments -n \
22 "(1 -)"{-s,--source=}"[Select source]:SOURCE:(cppreference.com cplusplus.com)" \
23 "(1 -)"{-c,--cache-all}"[Cache all available man pages from cppreference.com and cplusplus.com to enable offline browsing]" \
24 "(1 -)"{-C,--clear-cache}"[Clear all cached files.]" \
25 "(1 -)"{-f,--find-page=}"[Find man page.]:KEYWORD: " \
26 "(1 -)"{-h,--help}"[show help message and exit]" \
27 "(1 -)"{-o,--force-update}"[Force cppman to update existing cache when '--cache-all' or browsing man pages that were already cached.]" \
28 "(1 -)"{-m,--use-mandb=}"[If true, cppman adds manpage path to mandb so that you can view C++ manpages with 'man' command.]:MANDB:(true false)" \
29 "(1 -)"{-p,--pager=}"[Select pager to use.]:PAGER:(vim nvim less system)" \
30 "(1 -)"{-r,--rebuild-index}"[rebuild index database for the selected source.]" \
31 "(1 -)"{-v,--version}"[Show version information.]" \
32 "--force-columns=[Force terminal columns]:FORCE_COLUMNS:" \
33 "1:man page:_cppman_pages" \