@builder.io/dev-tools-windows-x64 1.19.9 → 1.19.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,665 @@
1
+ #compdef rg
2
+
3
+ ##
4
+ # zsh completion function for ripgrep
5
+ #
6
+ # Run ci/test-complete after building to ensure that the options supported by
7
+ # this function stay in synch with the `rg` binary.
8
+ #
9
+ # For convenience, a completion reference guide is included at the bottom of
10
+ # this file.
11
+ #
12
+ # Originally based on code from the zsh-users project — see copyright notice
13
+ # below.
14
+
15
+ _rg() {
16
+ local curcontext=$curcontext no='!' descr ret=1
17
+ local -a context line state state_descr args tmp suf
18
+ local -A opt_args
19
+
20
+ # ripgrep has many options which negate the effect of a more common one — for
21
+ # example, `--no-column` to negate `--column`, and `--messages` to negate
22
+ # `--no-messages`. There are so many of these, and they're so infrequently
23
+ # used, that some users will probably find it irritating if they're completed
24
+ # indiscriminately, so let's not do that unless either the current prefix
25
+ # matches one of those negation options or the user has the `complete-all`
26
+ # style set. Note that this prefix check has to be updated manually to account
27
+ # for all of the potential negation options listed below!
28
+ if
29
+ # We also want to list all of these options during testing
30
+ [[ $_RG_COMPLETE_LIST_ARGS == (1|t*|y*) ]] ||
31
+ # (--[imnp]* => --ignore*, --messages, --no-*, --pcre2-unicode)
32
+ [[ $PREFIX$SUFFIX == --[imnp]* ]] ||
33
+ zstyle -t ":completion:${curcontext}:" complete-all
34
+ then
35
+ no=
36
+ fi
37
+
38
+ # We make heavy use of argument groups here to prevent the option specs from
39
+ # growing unwieldy. These aren't supported in zsh <5.4, though, so we'll strip
40
+ # them out below if necessary. This makes the exclusions inaccurate on those
41
+ # older versions, but oh well — it's not that big a deal
42
+ args=(
43
+ + '(exclusive)' # Misc. fully exclusive options
44
+ '(: * -)'{-h,--help}'[display help information]'
45
+ '(: * -)'{-V,--version}'[display version information]'
46
+ '(: * -)'--pcre2-version'[print the version of PCRE2 used by ripgrep, if available]'
47
+
48
+ + '(buffered)' # buffering options
49
+ '--line-buffered[force line buffering]'
50
+ $no"--no-line-buffered[don't force line buffering]"
51
+ '--block-buffered[force block buffering]'
52
+ $no"--no-block-buffered[don't force block buffering]"
53
+
54
+ + '(case)' # Case-sensitivity options
55
+ {-i,--ignore-case}'[search case-insensitively]'
56
+ {-s,--case-sensitive}'[search case-sensitively]'
57
+ {-S,--smart-case}'[search case-insensitively if pattern is all lowercase]'
58
+
59
+ + '(context-a)' # Context (after) options
60
+ '(context-c)'{-A+,--after-context=}'[specify lines to show after each match]:number of lines'
61
+
62
+ + '(context-b)' # Context (before) options
63
+ '(context-c)'{-B+,--before-context=}'[specify lines to show before each match]:number of lines'
64
+
65
+ + '(context-c)' # Context (combined) options
66
+ '(context-a context-b)'{-C+,--context=}'[specify lines to show before and after each match]:number of lines'
67
+
68
+ + '(column)' # Column options
69
+ '--column[show column numbers for matches]'
70
+ $no"--no-column[don't show column numbers for matches]"
71
+
72
+ + '(count)' # Counting options
73
+ {-c,--count}'[only show count of matching lines for each file]'
74
+ '--count-matches[only show count of individual matches for each file]'
75
+ '--include-zero[include files with zero matches in summary]'
76
+ $no"--no-include-zero[don't include files with zero matches in summary]"
77
+
78
+ + '(encoding)' # Encoding options
79
+ {-E+,--encoding=}'[specify text encoding of files to search]: :_rg_encodings'
80
+ $no'--no-encoding[use default text encoding]'
81
+
82
+ + '(engine)' # Engine choice options
83
+ '--engine=[select which regex engine to use]:when:((
84
+ default\:"use default engine"
85
+ pcre2\:"identical to --pcre2"
86
+ auto\:"identical to --auto-hybrid-regex"
87
+ ))'
88
+
89
+ + file # File-input options
90
+ '(1)*'{-f+,--file=}'[specify file containing patterns to search for]: :_files'
91
+
92
+ + '(file-match)' # Files with/without match options
93
+ '(stats)'{-l,--files-with-matches}'[only show names of files with matches]'
94
+ '(stats)--files-without-match[only show names of files without matches]'
95
+
96
+ + '(file-name)' # File-name options
97
+ {-H,--with-filename}'[show file name for matches]'
98
+ {-I,--no-filename}"[don't show file name for matches]"
99
+
100
+ + '(file-system)' # File system options
101
+ "--one-file-system[don't descend into directories on other file systems]"
102
+ $no'--no-one-file-system[descend into directories on other file systems]'
103
+
104
+ + '(fixed)' # Fixed-string options
105
+ {-F,--fixed-strings}'[treat pattern as literal string instead of regular expression]'
106
+ $no"--no-fixed-strings[don't treat pattern as literal string]"
107
+
108
+ + '(follow)' # Symlink-following options
109
+ {-L,--follow}'[follow symlinks]'
110
+ $no"--no-follow[don't follow symlinks]"
111
+
112
+ + '(generate)' # Options for generating ancillary data
113
+ '--generate=[generate man page or completion scripts]:when:((
114
+ man\:"man page"
115
+ complete-bash\:"shell completions for bash"
116
+ complete-zsh\:"shell completions for zsh"
117
+ complete-fish\:"shell completions for fish"
118
+ complete-powershell\:"shell completions for PowerShell"
119
+ ))'
120
+
121
+ + glob # File-glob options
122
+ '*'{-g+,--glob=}'[include/exclude files matching specified glob]:glob'
123
+ '*--iglob=[include/exclude files matching specified case-insensitive glob]:glob'
124
+
125
+ + '(glob-case-insensitive)' # File-glob case sensitivity options
126
+ '--glob-case-insensitive[treat -g/--glob patterns case insensitively]'
127
+ $no'--no-glob-case-insensitive[treat -g/--glob patterns case sensitively]'
128
+
129
+ + '(heading)' # Heading options
130
+ '(pretty-vimgrep)--heading[show matches grouped by file name]'
131
+ "(pretty-vimgrep)--no-heading[don't show matches grouped by file name]"
132
+
133
+ + '(hidden)' # Hidden-file options
134
+ {-.,--hidden}'[search hidden files and directories]'
135
+ $no"--no-hidden[don't search hidden files and directories]"
136
+
137
+ + '(hybrid)' # hybrid regex options
138
+ '--auto-hybrid-regex[DEPRECATED: dynamically use PCRE2 if necessary]'
139
+ $no"--no-auto-hybrid-regex[DEPRECATED: don't dynamically use PCRE2 if necessary]"
140
+
141
+ + '(ignore)' # Ignore-file options
142
+ "(--no-ignore-global --no-ignore-parent --no-ignore-vcs --no-ignore-dot)--no-ignore[don't respect ignore files]"
143
+ $no'(--ignore-global --ignore-parent --ignore-vcs --ignore-dot)--ignore[respect ignore files]'
144
+
145
+ + '(ignore-file-case-insensitive)' # Ignore-file case sensitivity options
146
+ '--ignore-file-case-insensitive[process ignore files case insensitively]'
147
+ $no'--no-ignore-file-case-insensitive[process ignore files case sensitively]'
148
+
149
+ + '(ignore-exclude)' # Local exclude (ignore)-file options
150
+ "--no-ignore-exclude[don't respect local exclude (ignore) files]"
151
+ $no'--ignore-exclude[respect local exclude (ignore) files]'
152
+
153
+ + '(ignore-global)' # Global ignore-file options
154
+ "--no-ignore-global[don't respect global ignore files]"
155
+ $no'--ignore-global[respect global ignore files]'
156
+
157
+ + '(ignore-parent)' # Parent ignore-file options
158
+ "--no-ignore-parent[don't respect ignore files in parent directories]"
159
+ $no'--ignore-parent[respect ignore files in parent directories]'
160
+
161
+ + '(ignore-vcs)' # VCS ignore-file options
162
+ "--no-ignore-vcs[don't respect version control ignore files]"
163
+ $no'--ignore-vcs[respect version control ignore files]'
164
+
165
+ + '(require-git)' # git specific settings
166
+ "--no-require-git[don't require git repository to respect gitignore rules]"
167
+ $no'--require-git[require git repository to respect gitignore rules]'
168
+
169
+ + '(ignore-dot)' # .ignore options
170
+ "--no-ignore-dot[don't respect .ignore files]"
171
+ $no'--ignore-dot[respect .ignore files]'
172
+
173
+ + '(ignore-files)' # custom global ignore file options
174
+ "--no-ignore-files[don't respect --ignore-file flags]"
175
+ $no'--ignore-files[respect --ignore-file files]'
176
+
177
+ + '(json)' # JSON options
178
+ '--json[output results in JSON Lines format]'
179
+ $no"--no-json[don't output results in JSON Lines format]"
180
+
181
+ + '(line-number)' # Line-number options
182
+ {-n,--line-number}'[show line numbers for matches]'
183
+ {-N,--no-line-number}"[don't show line numbers for matches]"
184
+
185
+ + '(line-terminator)' # Line-terminator options
186
+ '--crlf[use CRLF as line terminator]'
187
+ $no"--no-crlf[don't use CRLF as line terminator]"
188
+ '(text)--null-data[use NUL as line terminator]'
189
+
190
+ + '(max-columns-preview)' # max column preview options
191
+ '--max-columns-preview[show preview for long lines (with -M)]'
192
+ $no"--no-max-columns-preview[don't show preview for long lines (with -M)]"
193
+
194
+ + '(max-depth)' # Directory-depth options
195
+ {-d,--max-depth}'[specify max number of directories to descend]:number of directories'
196
+ '--maxdepth=[alias for --max-depth]:number of directories'
197
+ '!--maxdepth=:number of directories'
198
+
199
+ + '(messages)' # Error-message options
200
+ '(--no-ignore-messages)--no-messages[suppress some error messages]'
201
+ $no"--messages[don't suppress error messages affected by --no-messages]"
202
+
203
+ + '(messages-ignore)' # Ignore-error message options
204
+ "--no-ignore-messages[don't show ignore-file parse error messages]"
205
+ $no'--ignore-messages[show ignore-file parse error messages]'
206
+
207
+ + '(mmap)' # mmap options
208
+ '--mmap[search using memory maps when possible]'
209
+ "--no-mmap[don't search using memory maps]"
210
+
211
+ + '(multiline)' # Multiline options
212
+ {-U,--multiline}'[permit matching across multiple lines]'
213
+ $no'(multiline-dotall)--no-multiline[restrict matches to at most one line each]'
214
+
215
+ + '(multiline-dotall)' # Multiline DOTALL options
216
+ '(--no-multiline)--multiline-dotall[allow "." to match newline (with -U)]'
217
+ $no"(--no-multiline)--no-multiline-dotall[don't allow \".\" to match newline (with -U)]"
218
+
219
+ + '(only)' # Only-match options
220
+ {-o,--only-matching}'[show only matching part of each line]'
221
+
222
+ + '(passthru)' # Pass-through options
223
+ '(--vimgrep)--passthru[show both matching and non-matching lines]'
224
+ '(--vimgrep)--passthrough[alias for --passthru]'
225
+
226
+ + '(pcre2)' # PCRE2 options
227
+ {-P,--pcre2}'[enable matching with PCRE2]'
228
+ $no'(pcre2-unicode)--no-pcre2[disable matching with PCRE2]'
229
+
230
+ + '(pcre2-unicode)' # PCRE2 Unicode options
231
+ $no'(--no-pcre2 --no-pcre2-unicode)--pcre2-unicode[DEPRECATED: enable PCRE2 Unicode mode (with -P)]'
232
+ '(--no-pcre2 --pcre2-unicode)--no-pcre2-unicode[DEPRECATED: disable PCRE2 Unicode mode (with -P)]'
233
+
234
+ + '(pre)' # Preprocessing options
235
+ '(-z --search-zip)--pre=[specify preprocessor utility]:preprocessor utility:_command_names -e'
236
+ $no'--no-pre[disable preprocessor utility]'
237
+
238
+ + pre-glob # Preprocessing glob options
239
+ '*--pre-glob[include/exclude files for preprocessing with --pre]'
240
+
241
+ + '(pretty-vimgrep)' # Pretty/vimgrep display options
242
+ '(heading)'{-p,--pretty}'[alias for --color=always --heading -n]'
243
+ '(heading passthru)--vimgrep[show results in vim-compatible format]'
244
+
245
+ + regexp # Explicit pattern options
246
+ '(1 file)*'{-e+,--regexp=}'[specify pattern]:pattern'
247
+
248
+ + '(replace)' # Replacement options
249
+ {-r+,--replace=}'[specify string used to replace matches]:replace string'
250
+
251
+ + '(sort)' # File-sorting options
252
+ '(threads)--sort=[sort results in ascending order (disables parallelism)]:sort method:((
253
+ none\:"no sorting"
254
+ path\:"sort by file path"
255
+ modified\:"sort by last modified time"
256
+ accessed\:"sort by last accessed time"
257
+ created\:"sort by creation time"
258
+ ))'
259
+ '(threads)--sortr=[sort results in descending order (disables parallelism)]:sort method:((
260
+ none\:"no sorting"
261
+ path\:"sort by file path"
262
+ modified\:"sort by last modified time"
263
+ accessed\:"sort by last accessed time"
264
+ created\:"sort by creation time"
265
+ ))'
266
+ '(threads)--sort-files[DEPRECATED: sort results by file path (disables parallelism)]'
267
+ $no"--no-sort-files[DEPRECATED: do not sort results]"
268
+
269
+ + '(stats)' # Statistics options
270
+ '(--files file-match)--stats[show search statistics]'
271
+ $no"--no-stats[don't show search statistics]"
272
+
273
+ + '(text)' # Binary-search options
274
+ {-a,--text}'[search binary files as if they were text]'
275
+ "--binary[search binary files, don't print binary data]"
276
+ $no"--no-binary[don't search binary files]"
277
+ $no"(--null-data)--no-text[don't search binary files as if they were text]"
278
+
279
+ + '(threads)' # Thread-count options
280
+ '(sort)'{-j+,--threads=}'[specify approximate number of threads to use]:number of threads'
281
+
282
+ + '(trim)' # Trim options
283
+ '--trim[trim any ASCII whitespace prefix from each line]'
284
+ $no"--no-trim[don't trim ASCII whitespace prefix from each line]"
285
+
286
+ + type # Type options
287
+ '*'{-t+,--type=}'[only search files matching specified type]: :_rg_types'
288
+ '*--type-add=[add new glob for specified file type]: :->typespec'
289
+ '*--type-clear=[clear globs previously defined for specified file type]: :_rg_types'
290
+ # This should actually be exclusive with everything but other type options
291
+ '(: *)--type-list[show all supported file types and their associated globs]'
292
+ '*'{-T+,--type-not=}"[don't search files matching specified file type]: :_rg_types"
293
+
294
+ + '(word-line)' # Whole-word/line match options
295
+ {-w,--word-regexp}'[only show matches surrounded by word boundaries]'
296
+ {-x,--line-regexp}'[only show matches surrounded by line boundaries]'
297
+
298
+ + '(unicode)' # Unicode options
299
+ $no'--unicode[enable Unicode mode]'
300
+ '--no-unicode[disable Unicode mode]'
301
+
302
+ + '(zip)' # Compression options
303
+ '(--pre)'{-z,--search-zip}'[search in compressed files]'
304
+ $no"--no-search-zip[don't search in compressed files]"
305
+
306
+ + misc # Other options — no need to separate these at the moment
307
+ '(-b --byte-offset)'{-b,--byte-offset}'[show 0-based byte offset for each matching line]'
308
+ $no"--no-byte-offset[don't show byte offsets for each matching line]"
309
+ '--color=[specify when to use colors in output]:when:((
310
+ never\:"never use colors"
311
+ auto\:"use colors or not based on stdout, TERM, etc."
312
+ always\:"always use colors"
313
+ ansi\:"always use ANSI colors (even on Windows)"
314
+ ))'
315
+ '*--colors=[specify color and style settings]: :->colorspec'
316
+ '--context-separator=[specify string used to separate non-continuous context lines in output]:separator'
317
+ $no"--no-context-separator[don't print context separators]"
318
+ '--debug[show debug messages]'
319
+ '--field-context-separator[set string to delimit fields in context lines]'
320
+ '--field-match-separator[set string to delimit fields in matching lines]'
321
+ '--hostname-bin=[executable for getting system hostname]:hostname executable:_command_names -e'
322
+ '--hyperlink-format=[specify pattern for hyperlinks]:pattern'
323
+ '--trace[show more verbose debug messages]'
324
+ '--dfa-size-limit=[specify upper size limit of generated DFA]:DFA size (bytes)'
325
+ "(1 stats)--files[show each file that would be searched (but don't search)]"
326
+ '*--ignore-file=[specify additional ignore file]:ignore file:_files'
327
+ '(-v --invert-match)'{-v,--invert-match}'[invert matching]'
328
+ $no"--no-invert-match[do not invert matching]"
329
+ '(-M --max-columns)'{-M+,--max-columns=}'[specify max length of lines to print]:number of bytes'
330
+ '(-m --max-count)'{-m+,--max-count=}'[specify max number of matches per file]:number of matches'
331
+ '--max-filesize=[specify size above which files should be ignored]:file size (bytes)'
332
+ "--no-config[don't load configuration files]"
333
+ '(-0 --null)'{-0,--null}'[print NUL byte after file names]'
334
+ '--path-separator=[specify path separator to use when printing file names]:separator'
335
+ '(-q --quiet)'{-q,--quiet}'[suppress normal output]'
336
+ '--regex-size-limit=[specify upper size limit of compiled regex]:regex size (bytes)'
337
+ '*'{-u,--unrestricted}'[reduce level of "smart" searching]'
338
+ '--stop-on-nonmatch[stop on first non-matching line after a matching one]'
339
+
340
+ + operand # Operands
341
+ '(--files --type-list file regexp)1: :_guard "^-*" pattern'
342
+ '(--type-list)*: :_files'
343
+ )
344
+
345
+ # This is used with test-complete to verify that there are no options
346
+ # listed in the help output that aren't also defined here
347
+ [[ $_RG_COMPLETE_LIST_ARGS == (1|t*|y*) ]] && {
348
+ print -rl - $args
349
+ return 0
350
+ }
351
+
352
+ # Strip out argument groups where unsupported (see above)
353
+ [[ $ZSH_VERSION == (4|5.<0-3>)(.*)# ]] &&
354
+ args=( ${(@)args:#(#i)(+|[a-z0-9][a-z0-9_-]#|\([a-z0-9][a-z0-9_-]#\))} )
355
+
356
+ _arguments -C -s -S : $args && ret=0
357
+
358
+ case $state in
359
+ colorspec)
360
+ if [[ ${IPREFIX#--*=}$PREFIX == [^:]# ]]; then
361
+ suf=( -qS: )
362
+ tmp=(
363
+ 'column:specify coloring for column numbers'
364
+ 'line:specify coloring for line numbers'
365
+ 'match:specify coloring for match text'
366
+ 'path:specify coloring for file names'
367
+ )
368
+ descr='color/style type'
369
+ elif [[ ${IPREFIX#--*=}$PREFIX == (column|line|match|path):[^:]# ]]; then
370
+ suf=( -qS: )
371
+ tmp=(
372
+ 'none:clear color/style for type'
373
+ 'bg:specify background color'
374
+ 'fg:specify foreground color'
375
+ 'style:specify text style'
376
+ )
377
+ descr='color/style attribute'
378
+ elif [[ ${IPREFIX#--*=}$PREFIX == [^:]##:(bg|fg):[^:]# ]]; then
379
+ tmp=( black blue green red cyan magenta yellow white )
380
+ descr='color name or r,g,b'
381
+ elif [[ ${IPREFIX#--*=}$PREFIX == [^:]##:style:[^:]# ]]; then
382
+ tmp=( {,no}bold {,no}intense {,no}underline )
383
+ descr='style name'
384
+ else
385
+ _message -e colorspec 'no more arguments'
386
+ fi
387
+
388
+ (( $#tmp )) && {
389
+ compset -P '*:'
390
+ _describe -t colorspec $descr tmp $suf && ret=0
391
+ }
392
+ ;;
393
+
394
+ typespec)
395
+ if compset -P '[^:]##:include:'; then
396
+ _sequence -s , _rg_types && ret=0
397
+ # @todo This bit in particular could be better, but it's a little
398
+ # complex, and attempting to solve it seems to run us up against a crash
399
+ # bug — zsh # 40362
400
+ elif compset -P '[^:]##:'; then
401
+ _message 'glob or include directive' && ret=1
402
+ elif [[ ! -prefix *:* ]]; then
403
+ _rg_types -qS : && ret=0
404
+ fi
405
+ ;;
406
+ esac
407
+
408
+ return ret
409
+ }
410
+
411
+ # Complete encodings
412
+ _rg_encodings() {
413
+ local -a expl
414
+ local -aU _encodings
415
+
416
+ _encodings=(
417
+ # This is impossible to read, but these encodings rarely if ever change, so
418
+ # it probably does not matter. They are derived from the list given here:
419
+ # https://encoding.spec.whatwg.org/#concept-encoding-get
420
+ #
421
+ # The globbing here works in both fish and zsh (though they expand it in
422
+ # different orders). It may work in other shells too.
423
+
424
+ {{,us-}ascii,arabic,chinese,cyrillic,greek{,8},hebrew,korean}
425
+ logical visual mac {,cs}macintosh x-mac-{cyrillic,roman,ukrainian}
426
+ 866 ibm{819,866} csibm866
427
+ big5{,-hkscs} {cn-,cs}big5 x-x-big5
428
+ cp{819,866,125{0,1,2,3,4,5,6,7,8}} x-cp125{0,1,2,3,4,5,6,7,8}
429
+ csiso2022{jp,kr} csiso8859{6,8}{e,i}
430
+ csisolatin{1,2,3,4,5,6,9} csisolatin{arabic,cyrillic,greek,hebrew}
431
+ ecma-{114,118} asmo-708 elot_928 sun_eu_greek
432
+ euc-{jp,kr} x-euc-jp cseuckr cseucpkdfmtjapanese
433
+ {,x-}gbk csiso58gb231280 gb18030 {,cs}gb2312 gb_2312{,-80} hz-gb-2312
434
+ iso-2022-{cn,cn-ext,jp,kr}
435
+ iso8859{,-}{1,2,3,4,5,6,7,8,9,10,11,13,14,15}
436
+ iso-8859-{1,2,3,4,5,6,7,8,9,10,11,{6,8}-{e,i},13,14,15,16} iso_8859-{1,2,3,4,5,6,7,8,9,15}
437
+ iso_8859-{1,2,6,7}:1987 iso_8859-{3,4,5,8}:1988 iso_8859-9:1989
438
+ iso-ir-{58,100,101,109,110,126,127,138,144,148,149,157}
439
+ koi{,8,8-r,8-ru,8-u,8_r} cskoi8r
440
+ ks_c_5601-{1987,1989} ksc{,_}5691 csksc56011987
441
+ latin{1,2,3,4,5,6} l{1,2,3,4,5,6,9}
442
+ shift{-,_}jis csshiftjis {,x-}sjis ms_kanji ms932
443
+ utf{,-}8 utf-16{,be,le} unicode-1-1-utf-8
444
+ windows-{31j,874,949,125{0,1,2,3,4,5,6,7,8}} dos-874 tis-620 ansi_x3.4-1968
445
+ x-user-defined auto none
446
+ )
447
+
448
+ _wanted encodings expl encoding compadd -a "$@" - _encodings
449
+ }
450
+
451
+ # Complete file types
452
+ _rg_types() {
453
+ local -a expl
454
+ local -aU _types
455
+
456
+ _types=( ${(@)${(f)"$( _call_program types $words[1] --type-list )"}//:[[:space:]]##/:} )
457
+
458
+ if zstyle -t ":completion:${curcontext}:types" extra-verbose; then
459
+ _describe -t types 'file type' _types
460
+ else
461
+ _wanted types expl 'file type' compadd "$@" - ${(@)_types%%:*}
462
+ fi
463
+ }
464
+
465
+ _rg "$@"
466
+
467
+ ################################################################################
468
+ # ZSH COMPLETION REFERENCE
469
+ #
470
+ # For the convenience of developers who aren't especially familiar with zsh
471
+ # completion functions, a brief reference guide follows. This is in no way
472
+ # comprehensive; it covers just enough of the basic structure, syntax, and
473
+ # conventions to help someone make simple changes like adding new options. For
474
+ # more complete documentation regarding zsh completion functions, please see the
475
+ # following:
476
+ #
477
+ # * http://zsh.sourceforge.net/Doc/Release/Completion-System.html
478
+ # * https://github.com/zsh-users/zsh/blob/master/Etc/completion-style-guide
479
+ #
480
+ # OVERVIEW
481
+ #
482
+ # Most zsh completion functions are defined in terms of `_arguments`, which is a
483
+ # shell function that takes a series of argument specifications. The specs for
484
+ # `rg` are stored in an array, which is common for more complex functions; the
485
+ # elements of the array are passed to `_arguments` on invocation.
486
+ #
487
+ # ARGUMENT-SPECIFICATION SYNTAX
488
+ #
489
+ # The following is a contrived example of the argument specs for a simple tool:
490
+ #
491
+ # '(: * -)'{-h,--help}'[display help information]'
492
+ # '(-q -v --quiet --verbose)'{-q,--quiet}'[decrease output verbosity]'
493
+ # '!(-q -v --quiet --verbose)--silent'
494
+ # '(-q -v --quiet --verbose)'{-v,--verbose}'[increase output verbosity]'
495
+ # '--color=[specify when to use colors]:when:(always never auto)'
496
+ # '*:example file:_files'
497
+ #
498
+ # Although there may appear to be six specs here, there are actually nine; we
499
+ # use brace expansion to combine specs for options that go by multiple names,
500
+ # like `-q` and `--quiet`. This is customary, and ties in with the fact that zsh
501
+ # merges completion possibilities together when they have the same description.
502
+ #
503
+ # The first line defines the option `-h`/`--help`. With most tools, it isn't
504
+ # useful to complete anything after `--help` because it effectively overrides
505
+ # all others; the `(: * -)` at the beginning of the spec tells zsh not to
506
+ # complete any other operands (`:` and `*`) or options (`-`) after this one has
507
+ # been used. The `[...]` at the end associates a description with `-h`/`--help`;
508
+ # as mentioned, zsh will see the identical descriptions and merge these options
509
+ # together when offering completion possibilities.
510
+ #
511
+ # The next line defines `-q`/`--quiet`. Here we don't want to suppress further
512
+ # completions entirely, but we don't want to offer `-q` if `--quiet` has been
513
+ # given (since they do the same thing), nor do we want to offer `-v` (since it
514
+ # doesn't make sense to be quiet and verbose at the same time). We don't need to
515
+ # tell zsh not to offer `--quiet` a second time, since that's the default
516
+ # behaviour, but since this line expands to two specs describing `-q` *and*
517
+ # `--quiet` we do need to explicitly list all of them here.
518
+ #
519
+ # The next line defines a hidden option `--silent` — maybe it's a deprecated
520
+ # synonym for `--quiet`. The leading `!` indicates that zsh shouldn't offer this
521
+ # option during completion. The benefit of providing a spec for an option that
522
+ # shouldn't be completed is that, if someone *does* use it, we can correctly
523
+ # suppress completion of other options afterwards.
524
+ #
525
+ # The next line defines `-v`/`--verbose`; this works just like `-q`/`--quiet`.
526
+ #
527
+ # The next line defines `--color`. In this example, `--color` doesn't have a
528
+ # corresponding short option, so we don't need to use brace expansion. Further,
529
+ # there are no other options it's exclusive with (just itself), so we don't need
530
+ # to define those at the beginning. However, it does take a mandatory argument.
531
+ # The `=` at the end of `--color=` indicates that the argument may appear either
532
+ # like `--color always` or like `--color=always`; this is how most GNU-style
533
+ # command-line tools work. The corresponding short option would normally use `+`
534
+ # — for example, `-c+` would allow either `-c always` or `-calways`. For this
535
+ # option, the arguments are known ahead of time, so we can simply list them in
536
+ # parentheses at the end (`when` is used as the description for the argument).
537
+ #
538
+ # The last line defines an operand (a non-option argument). In this example, the
539
+ # operand can be used any number of times (the leading `*`), and it should be a
540
+ # file path, so we tell zsh to call the `_files` function to complete it. The
541
+ # `example file` in the middle is the description to use for this operand; we
542
+ # could use a space instead to accept the default provided by `_files`.
543
+ #
544
+ # GROUPING ARGUMENT SPECIFICATIONS
545
+ #
546
+ # Newer versions of zsh support grouping argument specs together. All specs
547
+ # following a `+` and then a group name are considered to be members of the
548
+ # named group. Grouping is useful mostly for organisational purposes; it makes
549
+ # the relationship between different options more obvious, and makes it easier
550
+ # to specify exclusions.
551
+ #
552
+ # We could rewrite our example above using grouping as follows:
553
+ #
554
+ # '(: * -)'{-h,--help}'[display help information]'
555
+ # '--color=[specify when to use colors]:when:(always never auto)'
556
+ # '*:example file:_files'
557
+ # + '(verbosity)'
558
+ # {-q,--quiet}'[decrease output verbosity]'
559
+ # '!--silent'
560
+ # {-v,--verbose}'[increase output verbosity]'
561
+ #
562
+ # Here we take advantage of a useful feature of spec grouping — when the group
563
+ # name is surrounded by parentheses, as in `(verbosity)`, it tells zsh that all
564
+ # of the options in that group are exclusive with each other. As a result, we
565
+ # don't need to manually list out the exclusions at the beginning of each
566
+ # option.
567
+ #
568
+ # Groups can also be referred to by name in other argument specs; for example:
569
+ #
570
+ # '(xyz)--aaa' '*: :_files'
571
+ # + xyz --xxx --yyy --zzz
572
+ #
573
+ # Here we use the group name `xyz` to tell zsh that `--xxx`, `--yyy`, and
574
+ # `--zzz` are not to be completed after `--aaa`. This makes the exclusion list
575
+ # much more compact and reusable.
576
+ #
577
+ # CONVENTIONS
578
+ #
579
+ # zsh completion functions generally adhere to the following conventions:
580
+ #
581
+ # * Use two spaces for indentation
582
+ # * Combine specs for options with different names using brace expansion
583
+ # * In combined specs, list the short option first (as in `{-a,--text}`)
584
+ # * Use `+` or `=` as described above for options that take arguments
585
+ # * Provide a description for all options, option-arguments, and operands
586
+ # * Capitalise/punctuate argument descriptions as phrases, not complete
587
+ # sentences — 'display help information', never 'Display help information.'
588
+ # (but still capitalise acronyms and proper names)
589
+ # * Write argument descriptions as verb phrases — 'display x', 'enable y',
590
+ # 'use z'
591
+ # * Word descriptions to make it clear when an option expects an argument;
592
+ # usually this is done with the word 'specify', as in 'specify x' or
593
+ # 'use specified x')
594
+ # * Write argument descriptions as tersely as possible — for example, articles
595
+ # like 'a' and 'the' should be omitted unless it would be confusing
596
+ #
597
+ # Other conventions currently used by this function:
598
+ #
599
+ # * Order argument specs alphabetically by group name, then option name
600
+ # * Group options that are directly related, mutually exclusive, or frequently
601
+ # referenced by other argument specs
602
+ # * Use only characters in the set [a-z0-9_-] in group names
603
+ # * Order exclusion lists as follows: short options, long options, groups
604
+ # * Use American English in descriptions
605
+ # * Use 'don't' in descriptions instead of 'do not'
606
+ # * Word descriptions for related options as similarly as possible. For example,
607
+ # `--foo[enable foo]` and `--no-foo[disable foo]`, or `--foo[use foo]` and
608
+ # `--no-foo[don't use foo]`
609
+ # * Word descriptions to make it clear when an option only makes sense with
610
+ # another option, usually by adding '(with -x)' to the end
611
+ # * Don't quote strings or variables unnecessarily. When quotes are required,
612
+ # prefer single-quotes to double-quotes
613
+ # * Prefix option specs with `$no` when the option serves only to negate the
614
+ # behaviour of another option that must be provided explicitly by the user.
615
+ # This prevents rarely used options from cluttering up the completion menu
616
+ ################################################################################
617
+
618
+ # ------------------------------------------------------------------------------
619
+ # Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
620
+ # All rights reserved.
621
+ #
622
+ # Redistribution and use in source and binary forms, with or without
623
+ # modification, are permitted provided that the following conditions are met:
624
+ # * Redistributions of source code must retain the above copyright
625
+ # notice, this list of conditions and the following disclaimer.
626
+ # * Redistributions in binary form must reproduce the above copyright
627
+ # notice, this list of conditions and the following disclaimer in the
628
+ # documentation and/or other materials provided with the distribution.
629
+ # * Neither the name of the zsh-users nor the
630
+ # names of its contributors may be used to endorse or promote products
631
+ # derived from this software without specific prior written permission.
632
+ #
633
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
634
+ # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
635
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
636
+ # DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
637
+ # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
638
+ # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
639
+ # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
640
+ # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
641
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
642
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
643
+ # ------------------------------------------------------------------------------
644
+ # Description
645
+ # -----------
646
+ #
647
+ # Completion script for ripgrep
648
+ #
649
+ # ------------------------------------------------------------------------------
650
+ # Authors
651
+ # -------
652
+ #
653
+ # * arcizan <ghostrevery@gmail.com>
654
+ # * MaskRay <i@maskray.me>
655
+ #
656
+ # ------------------------------------------------------------------------------
657
+
658
+ # Local Variables:
659
+ # mode: shell-script
660
+ # coding: utf-8-unix
661
+ # indent-tabs-mode: nil
662
+ # sh-indentation: 2
663
+ # sh-basic-offset: 2
664
+ # End:
665
+ # vim: ft=zsh sw=2 ts=2 et