summary refs log tree commit diff
path: root/Completion/Unix/Command/_texinfo
blob: 12d964e3f69023584991de7e5cc603cfa1480678 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#compdef info tkinfo install-info makeinfo texi2dvi texindex

local curcontext="$curcontext" state line ret=1
local -A opt_args
local -a info

case $service in
  info)
    info=( _call_program info ${words[1]} )
    _arguments -C -s \
      '(: -)--apropos=[look up string in indices]:search string: ' \
      '(-f --file)'{\*-d,\*--directory=}'[add directory to infopath]:info dir:_files -/' \
      '--dribble=[record keystrokes]:file with keystrokes:_files' \
      '(-f --file -d --directory)'{-f,--file=}'[info file to show]:info file:_files -g "*.info(|.gz|.bz2)(-.)"' \
      '(: - -h --help)'{-h,--help}'[display usage]' \
      '(-o --output -O)--index-search=[go directly to node if found]:search string: ' \
      '(--index-search -o --output -O)'{-o,--output=}'[dump selected nodes to filename]:filename:_files -g "*(-.)"' \
      '(-R --raw-escapes)'{-R,--raw-escapes}'[do not remove ANSI escapes from man pages]' \
      '--restore=[read keystrokes from file]:filename:_files -g "*(-.)"' \
      '(--index-search -o --output -O --show-options --usage)'{-O,--show-options,--usage}'[go to command-line options node]' \
      '--subnodes[recursively output menu items]' \
      '--vi-keys[use Vi-like key bindings]' \
      '(: -)--version[display version information]' \
      '(--apropos -h --help -O --output --version)*::menu item:->item' && ret=0

    info=( $info {(kv)opt_args[(I)(-d|--directory|-f|--file)]} )
  ;;
  install-info)
    if _pick_variant debian=Debian gnu --version; then
      _arguments -S \
        '(* -)--help[display help information]' \
        '(* -)--version[display version information]' \
        '(--maxwidth --align --calign)--remove[delete existing entries]' \
        '(--maxwidth --align --calign)--remove-exactly[delete existing entries taking exact entry name]' \
        '--section[specify section to add entry in]:regexp::title' \
        '--infodir=[specify directory containing dir file]:info directory:_files -/' \
        '--align=[specify minimum indentation for description]:indentation' \
        '--calign=[specify minimum indentation for continuation lines of description]:indentation' \
        '--maxwidth=[specify maximum width of dir file]:width' \
        '--quiet[suppress informational output]' \
        '--description=[specify description for menu entry]:description' \
        '--menuentry=[specify the menu entry for dir file]:menu entry' \
        '--keep-old=[inhibit replacement of existing entries/removal of empty sections]' \
        '--test[do not update dir file]' \
        '--debug[enable debugging]' \
        '*:info file:_files -g "*.info(-.)"'
	return
    else
      _arguments \
        '(--delete --remove)'{--delete,--remove}'[delete existing entries]' \
        '(2)--dir-file=[specify dir file]:dir file:_files -g "dir(-.)"' \
        \*{--entry,--info}'[specify directory entry to add]:text' \
        '(- 1 2)--help[display help information]' \
        '(1)--info-file=[specify info file to install in the directory]:info file:_files -g "*.info(-.)"' \
        '(2)--info-dir=[specify directory containing dir file]:info directory:_files -/' \
        '--quiet[suppress warnings]' \
        '(--delete --remove)--section=[put new entries in specified section]' \
        '(- 1 2)--version[display version information]' \
        '1:info file:_files -g "*.info(-.)"' \
        '2:dir file:_files -g "dir(-.)"'
	return
    fi
  ;;
  makeinfo)
    _arguments -s \
      '--error-limit=[specify number of errors to quit after]:number' \
      '--force[preserve output even if errors]' \
      '(* -)--help[display help]' \
      '--no-validate[suppress node cross-reference validation]' \
      '--no-warn[suppress warnings]' \
      '--reference-limit=[warn about at most specified number of references]:number' \
      '(-v --verbose)'{-v,--verbose}'[explain what is being done]' \
      '(* -)--version[display version info]' \
      '(--html --xml)--docbook[output in DocBook format]' \
      '(--docbook --xml)--html[output in HTML format]' \
      '--no-headers[suppress node separators and menus]' \
      '(--docbook --html)--xml[output in XML (TexinfoML) format]' \
      '(-E --macro-expand)'{-E,--macro-expand}'[output macro-expanded source to specified file]:file:_files' \
      '(--docbook --xml)--no-split[suppress splitting of output]' \
      '--number-sections[output chapter and section numbers]' \
      '(-o --output=)'{-o,--output}'[specify output file]:output file:_files' \
      '(--docbook --html --xml)--enable-encoding[output special characters]' \
      '(--docbook --html --xml)--fill-column=[specify width to break lines at]:width' \
      '(--docbook --html --xml)--footnote-style=[specify style for output of footnotes]:((separate\:in\ own\ node end\:at\ end\ of\ node))' \
      '(--docbook --html --xml)--paragraph-indent=[specify spaces to indent paragraphs by]' \
      '(--docbook --html --xml)--split-size=[split Info files at specified size]:size' \
      '--commands-in-node-names[allow @ commands in node names]' \
      '-D[define variable]:variable' \
      '-I[specify directory to append to @include search path]:directory:_files -/' \
      '-P[specify directory to prepend to @include search path]:directory:_files -/' \
      '-U[undefine variable]:variable' \
      '(--html --no-ifhtml)--ifhtml[process @ifhtml and @html when not generating HTML]' \
      '(--no-ifinfo)--ifinfo[process @ifinfo even when not generating Info]' \
      '(--no-iftex)--iftex[process @iftex and @tex text]' \
      '(--no-ifplaintext)--ifplaintext[process @ifplaintext even when not generating plain text]' \
      '(--ifhtml)--no-ifhtml[do not process @ifhtml and @html text]' \
      '(--ifinfo)--no-ifinfo[do not process @ifinfo text]' \
      '(--ifplaintext)--no-ifplaintext[do not process @ifplaintext text]' \
      '(--iftex)--no-iftex[do not process @iftex and @tex text]' \
      '*:texinfo file:_texi'
      return
  ;;
  texi2dvi)
    _arguments -s \
      '(-b --batch)'{-b,--batch}'[no interaction]' \
      '(-c --clean)'{-c,--clean}'[remove all auxiliary files]' \
      '(-D --debug)'{-D,--debug}'[turn on shell debugging (set -x)]' \
      '(- *)'{-h,--help}'[display help information]' \
      '(-o --output)'{-o,--output=}'[specify output file]:output file:_files' \
      '(-q -s --quiet --silent -V --verbose)'{-q,-s,--silent,--quiet}'[no output except errors]' \
      '(-q -s --quiet --silent -V --verbose)'{-V,--verbose}'[report on what is done]' \
      '(- *)'{-v,--version}'[display version information]' \
      '-@[use @input instead of \input; for preloaded Texinfo]' \
      '(-e --expand)'{-e,--expand}'[force macro expansion using makeinfo]' \
      '-I[specify search dir for texinfo files]:directory:_files -/' \
      '(-l --language)'{-l,--language}'[specify language of input file]:language:(LaTeX Texinfo)' \
      '(-p --pdf)'{-p,--pdf}'[use pdftex or pdflatex for processing]' \
      \*{-t,--texinfo}'[specify command to insert after @setfilename]:command' \
      '*:file:_texi'
      return
  ;;
  texindex)
    _arguments \
      '(* -)--help[display help]' \
      '(* -)--version[display version info]' \
      '(--no-keep)--keep[keep temporary files around after processing]' \
      '(--keep)--no-keep[do not keep temporary files (default)]' \
      '(-o --output)'{-o,--output=}'[specify output file]:file:_files' \
      '*:texinfo file:_texi'
      return
  ;;
  tkinfo)
    _x_arguments -C \
      '-+'{headers,buttons,balloons,scrollthrough,pagesep,showdir} \
      '-linklook:menu display:(color font underline)' \
      '-highlight:link display:(color inverse underline)' \
      '-searchlook:search match display:(color inverse underline)' \
      '-iconic' \
      '-dir:info path:_dir_list' \
      '-file:info file:_files -g "*.info(|.gz|.bz2)(-.)"' \
      '-node:info node:->item' \
      '*::menu items:->item' && ret=0
    info=( _call_program info info ${(kv)opt_args[(I)-file]/-file/-f} )
  ;;
esac

case $state in
  item )
    local -a items tags expl infopath
    (( $#INFOPATH )) && infopath=( -W ${s/:/INFOPATH} )

    tags=(items)
    if [[ $CURRENT -eq 1 ]]; then
	tags+=files
    fi

    _tags $tags
    while _tags; do
	if _requested files expl 'info file'; then
	    _files "$expl[@]" $infopath -g '*.info(-.)' && ret=0
	fi
	if _requested items; then
	    items=(${${(M)${${(f)"$(${info} --output - ${words[1,CURRENT-1]} 2>/dev/null)"}[1,(r)[[:space:]]#--- The Detailed Node Listing ---[[:space:]]#]}:#\* *~\* Menu:*}:/(#b)\*[[:space:]]##([^:]##):(#B)( \(?##\)[^.]#.|(:|))[[:space:]]#(#b)(*)[[:space:]]#/$match[1]${match[2]:+:}$match[2]})

	    _describe -t items "menu item" items && ret=0
	fi
    done
  ;;
esac

return ret