Sort by longopt.
This commit is contained in:
parent
d6e67e6acf
commit
b16fc9b44f
51
src/_ag
51
src/_ag
|
@ -53,14 +53,6 @@ _ag_add_version_opts() {
|
|||
local minor
|
||||
minor=$(_ag_version)
|
||||
|
||||
if [[ $minor -gt 15 ]];then
|
||||
AG_OPTS+=(
|
||||
'(--color-line-number)--color-line-number[Color codes for line numbers. Default is 1;33.]'
|
||||
'(--color-match)--color-match[Color codes for result match numbers. Default is 30;43.]'
|
||||
'(--color-path)--color-path[Color codes for path names. Default is 1;32.]'
|
||||
)
|
||||
fi
|
||||
|
||||
if [[ $minor -gt 21 ]];then
|
||||
_ag_add_file_types
|
||||
AG_OPTS+=(
|
||||
|
@ -77,14 +69,14 @@ _ag_add_version_opts() {
|
|||
|
||||
if [[ $minor -le 24 ]];then
|
||||
AG_OPTS+=(
|
||||
'(--noheading --heading)'{--noheading,--heading}'[print file names above matching contents]'
|
||||
'(-s --case-sensitive)'{-s,--case-sensitive}'[match case sensitively]'
|
||||
'(--noheading --heading)'{--noheading,--heading}'[print file names above matching contents]'
|
||||
)
|
||||
fi
|
||||
if [[ $minor -gt 24 ]];then
|
||||
AG_OPTS+=(
|
||||
'(-H --noheading --heading)'{-H,--noheading,--heading}'[print file names above matching contents]'
|
||||
'(-s --case-sensitive)'{-s,--case-sensitive}'[Match case sensitively. Default on.]'
|
||||
'(-H --noheading --heading)'{-H,--noheading,--heading}'[print file names above matching contents]'
|
||||
'(--vimgrep)--vimgrep[output results like vim''s, :vimgrep /pattern/g would (report every match on the line)]'
|
||||
)
|
||||
fi
|
||||
|
@ -135,37 +127,40 @@ _ag() {
|
|||
'(- 1 *)--man[print the manual page]'
|
||||
'(- 1 *)--version[display version and copyright information]'
|
||||
'(--ackmate)--ackmate[output results in a format parseable by AckMate]'
|
||||
'(-A --after)'{-A,--after}'[Print NUM lines before match. Default is 2]:LINES'
|
||||
'(-t --all-text)'{-t,--all-text}"[search all text files, not including hidden]"
|
||||
'(-a --all-types)'{-a,--all-types}"[Search all files. This doesn't include hidden files, and also doesn't respect any ignore files.]"
|
||||
'(-B --before)'{-B,--before}'[Print NUM lines after match. Defaults is 2]:LINES'
|
||||
'(-C --context)'{-C,--context}'[Print NUM lines before and after matches. Default is 2.]:LINES'
|
||||
'(--color-line-number)--color-line-number[Color codes for line numbers. Default is 1;33.]'
|
||||
'(--color-match)--color-match[Color codes for result match numbers. Default is 30;43.]'
|
||||
'(--color-path)--color-path[Color codes for path names. Default is 1;32.]'
|
||||
'(--column)--column[print column numbers in results]'
|
||||
'(-D --debug)'{-D,--debug}'[enable debug logging]'
|
||||
'(-G --file-search-regex)'{-G,--file-search-regex}'[only search file names matching PATTERN]:PATTERN'
|
||||
'(-l --files-with-matches)'{-l,--files-with-matches}'[only print filenames containing matches, not matching lines]'
|
||||
'(-L --files-without-matches)'{-L,--files-without-matches}"[only print filenames that don't contain matches]"
|
||||
'(-f --follow)'{-f,--follow}'[follow symlinks]'
|
||||
'(-g)-g[print filenames that match PATTERN]:PATTERN'
|
||||
'(--hidden)--hidden[search hidden files, still obeys ignore files.]'
|
||||
'(--ignore)--ignore[Ignore files/directories matching this pattern. Literal file and directory names are also allowed.]'
|
||||
'(-i --ignore-case)'{-i,--ignore-case}'[match case insensitively]:PATTERN'
|
||||
'(--ignore-dir)--ignore-dir[alias for --ignore for compatability with ack]'
|
||||
'(-v --invert-match)'{-v,--invert-match}'[invert match]'
|
||||
'(-Q --literal)'{-Q,--literal}'[Do not parse PATTERN as a regular expression. Try to match it literally.]'
|
||||
'(-m --max-count)'{-m,--max-count}'[Skip the rest of a file after NUM matches. Default is 10,000.]:NUM'
|
||||
'(--nobreak --break)'{--nobreak,--break}'[Print a newline between matches in different files. Default on.]'
|
||||
'(--nocolor --color)'{--nocolor,--color}'[Print color codes in results. Default on.]'
|
||||
'(--nogroup --group)'{--nogroup,--group}'[same as --\[no\]break --\[no\]heading]'
|
||||
'(--pager --nopager)'{--pager,--nopager}'[Display results with PAGER. Disabled by default.]'
|
||||
'(--passthrough)--passthrough[when searching a stream, print all lines even if they don''t match]'
|
||||
'(-p --path-to-agignore)'{-p,--path-to-agignore}'[provide a path to a specific .agignore file]:STRING'
|
||||
'(--print-long-lines)--print-long-lines[Print matches on very long lines (> 2k characters by default)]'
|
||||
'(--search-binary)--search-binary[search binary files for matches]'
|
||||
'(--stats)--stats[print stats (files scanned, time taken, etc)]'
|
||||
'(-A --after)'{-A,--after}'[Print NUM lines before match. Default is 2]:LINES'
|
||||
'(-B --before)'{-B,--before}'[Print NUM lines after match. Defaults is 2]:LINES'
|
||||
'(-C --context)'{-C,--context}'[Print NUM lines before and after matches. Default is 2.]:LINES'
|
||||
'(-D --debug)'{-D,--debug}'[enable debug logging]'
|
||||
'(-G --file-search-regex)'{-G,--file-search-regex}'[only search file names matching PATTERN]:PATTERN'
|
||||
'(-L --files-without-matches)'{-L,--files-without-matches}"[only print filenames that don't contain matches]"
|
||||
'(-Q --literal)'{-Q,--literal}'[Do not parse PATTERN as a regular expression. Try to match it literally.]'
|
||||
'(-S --smart-case)'{-S,--smart-case}'[match case sensitively if PATTERN contains any uppercase letters, else match case insensitively]'
|
||||
'(-U --skip-vcs-ignores)'{-U,--skip-vcs-ignores}'[ignore VCS ignore files (.gitigore, .hgignore, svn:ignore), but still use .agignore]'
|
||||
'(-a --all-types)'{-a,--all-types}"[Search all files. This doesn't include hidden files, and also doesn't respect any ignore files.]"
|
||||
'(-f --follow)'{-f,--follow}'[follow symlinks]'
|
||||
'(-g)-g[print filenames that match PATTERN]:PATTERN'
|
||||
'(-i --ignore-case)'{-i,--ignore-case}'[match case insensitively]:PATTERN'
|
||||
'(-l --files-with-matches)'{-l,--files-with-matches}'[only print filenames containing matches, not matching lines]'
|
||||
'(-m --max-count)'{-m,--max-count}'[Skip the rest of a file after NUM matches. Default is 10,000.]:NUM'
|
||||
'(-p --path-to-agignore)'{-p,--path-to-agignore}'[provide a path to a specific .agignore file]:STRING'
|
||||
'(-t --all-text)'{-t,--all-text}"[search all text files, not including hidden]"
|
||||
'(-S --smart-case)'{-S,--smart-case}'[match case sensitively if PATTERN contains any uppercase letters, else match case insensitively]'
|
||||
'(--stats)--stats[print stats (files scanned, time taken, etc)]'
|
||||
'(-u --unrestricted)'{-u,--unrestricted}'[Search *all* files. This ignores .agignore, .gitignore, etc. It searches binary and hidden files as well.]'
|
||||
'(-v --invert-match)'{-v,--invert-match}'[invert match]'
|
||||
'(-w --word-regexp)'{-w,--word-regexp}'[only match whole words]'
|
||||
'*: :_files'
|
||||
'1: :->patterns'
|
||||
|
|
Loading…
Reference in New Issue