X-Git-Url: https://git.grml.org/?a=blobdiff_plain;f=usr_share_grml%2Fzsh%2Fcompletion%2Funix%2F_hl_complete;fp=usr_share_grml%2Fzsh%2Fcompletion%2Funix%2F_hl_complete;h=28363d4761ca1b092817da09a69115ff01a47951;hb=e1491794ce35da3eb1b7a3731f1e1b9a5e93a9a0;hp=0000000000000000000000000000000000000000;hpb=2b851312434213e81b0ecb5d0478d07fd4b045e8;p=grml-etc-core.git diff --git a/usr_share_grml/zsh/completion/unix/_hl_complete b/usr_share_grml/zsh/completion/unix/_hl_complete new file mode 100644 index 0000000..28363d4 --- /dev/null +++ b/usr_share_grml/zsh/completion/unix/_hl_complete @@ -0,0 +1,17 @@ +#compdef hl + +function _hl_genarg() { + local expl + if [[ -prefix 1 *: ]] ; then + local themes + themes=(${${${(f)"$(LC_ALL=C highlight --list-themes)"}/ #/}:#*(Installed|Use name)*}) + compset -P 1 '*:' + _wanted -C list themes expl theme compadd ${themes} + else + local langs + langs=(${${${(f)"$(LC_ALL=C highlight --list-langs)"}/ #/}:#*(Installed|Use name)*}) + _wanted -C list languages expl languages compadd -S ':' -q ${langs} + fi +} + +_arguments -s '1: :_hl_genarg' '2:files:_path_files'