X-Git-Url: https://git.grml.org/?a=blobdiff_plain;f=usr_share_grml%2Fzsh%2Fcompletion%2Fgrml%2F_grml-tips;fp=usr_share_grml%2Fzsh%2Fcompletion%2Fgrml%2F_grml-tips;h=27cd7db90ce8e23028b467dc6648d5b115ce9b19;hb=8600fe02472f8199af5b1a07b3c987f6168e16b1;hp=0000000000000000000000000000000000000000;hpb=3be9a79008239ca42f7262056a96df6584d58bd8;p=grml-etc-core.git diff --git a/usr_share_grml/zsh/completion/grml/_grml-tips b/usr_share_grml/zsh/completion/grml/_grml-tips new file mode 100644 index 0000000..27cd7db --- /dev/null +++ b/usr_share_grml/zsh/completion/grml/_grml-tips @@ -0,0 +1,24 @@ +#compdef grml-tips + +local db=/usr/share/grml-tips/tags +local -a args + +if [[ ! -e $db ]]; then + _message 'Tip database not found: `'$db\' + return 0 +fi + +__grml-tips-tags () { + local expl + local -a tags + + tags=( ${(f)"$(<$db)"} ) + _wanted tag expl 'grml-tips tag' compadd ${expl} -- ${tags} +} + +args=( '--help[Display help message]' + '--tagsonly[Match only by tag, not by pattern]' + '--tipsfile[Use non-default tips-file]:_path_files' + '*::grml-tips tag:__grml-tips-tags' ) + +_arguments $args