Skip to content

Instantly share code, notes, and snippets.

@wtsnjp
Last active February 3, 2023 16:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wtsnjp/07d2b4acb04d5286d12d10d6021c2716 to your computer and use it in GitHub Desktop.
Save wtsnjp/07d2b4acb04d5286d12d10d6021c2716 to your computer and use it in GitHub Desktop.
A zsh completion for Texdoc
#compdef texdoc
#
# This is file '_texdoc' a zsh completion script for texdoc.
#
# Copyright (c) 2018 Takuto ASAKURA (wtsnjp)
# GitHub: https://github.com/wtsnjp
# Twitter: @wtsnjp
#
# This script is distributed under the MIT License.
#
_arguments -C -A "-*" \
'(-)'{-w,--view}'[use view mode]' \
'(-)'{-m,--mixed}'[use mixed mode]' \
'(-)'{-l,--list}'[use list mode]' \
'(-)'{-s,--showall}'[use showall mode]' \
'(-)'{-i,--interact}'[use intractive menus]' \
'(-)'{-I,--nointeract}'[use plain lists]' \
'(-)'{-M,--machine}'[machine-readable output]' \
'(-)'{-q,--quiet}'[show less texts]' \
'(-)'{-v,--verbose}'[show more texts]' \
'(-)-D[activate all debug output]' \
'(-)-d[activate the debug category]: :->category' \
'(-)--debug=-[activate debug output]: :->category' \
'(-)-c[set a configuration item]' \
'(- *)'{-h,--help}'[show help]' \
'(- *)'{-V,--version}'[show version]' \
'(- *)'{-f,--files}'[show configuration files]' \
'(- *)--just-view[just display the given file]: :_files' \
'*: :->package' && return 0
local tlpdb="$(kpsewhich -var-value TEXMFROOT)/tlpkg/texlive.tlpdb"
case $state in
category)
_values 'category' \
'all' 'config' 'files' 'score' 'search' 'texdocs' 'tlpdb' 'version' 'view'
;;
package)
_values 'package' $(awk '/^name[^.]*$/ {print $2}' $tlpdb)
;;
esac
# vim: ft=zsh:
@Freed-Wu
Copy link

This source can be contributed to zsh-completions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment