Add completion for grml-tips [Closes: issue988]
[grml-etc-core.git] / usr_share_grml / zsh / completion / grml / _grml-tips
1 #compdef grml-tips
2
3 local db=/usr/share/grml-tips/tags
4 local -a args
5
6 if [[ ! -e $db ]]; then
7     _message 'Tip database not found: `'$db\'
8     return 0
9 fi
10
11 __grml-tips-tags () {
12     local expl
13     local -a tags
14
15     tags=( ${(f)"$(<$db)"} )
16     _wanted tag expl 'grml-tips tag' compadd ${expl} -- ${tags}
17 }
18
19 args=( '--help[Display help message]'
20        '--tagsonly[Match only by tag, not by pattern]'
21        '--tipsfile[Use non-default tips-file]:_path_files'
22        '*::grml-tips tag:__grml-tips-tags' )
23
24 _arguments $args