代码拉取完成,页面将自动刷新
_ag() {
local lngopt shtopt split=false
local cur prev
COMPREPLY=()
cur=$(_get_cword "=")
prev="${COMP_WORDS[COMP_CWORD-1]}"
_expand || return 0
lngopt='
--ackmate
--ackmate-dir-filter
--affinity
--after
--all-text
--all-types
--before
--break
--case-sensitive
--color
--color-line-number
--color-match
--color-path
--color-win-ansi
--column
--context
--count
--debug
--depth
--file-search-regex
--filename
--files-with-matches
--files-without-matches
--fixed-strings
--follow
--group
--heading
--help
--hidden
--ignore
--ignore-case
--ignore-dir
--invert-match
--line-numbers
--list-file-types
--literal
--match
--max-count
--no-numbers
--no-recurse
--noaffinity
--nobreak
--nocolor
--nofilename
--nofollow
--nogroup
--noheading
--nonumbers
--nopager
--norecurse
--null
--numbers
--one-device
--only-matching
--pager
--parallel
--passthrough
--passthru
--path-to-ignore
--print-long-lines
--print0
--recurse
--search-binary
--search-files
--search-zip
--silent
--skip-vcs-ignores
--smart-case
--stats
--unrestricted
--version
--vimgrep
--word-regexp
--workers
'
shtopt='
-a -A -B -C -D
-f -F -g -G -h
-i -l -L -m -n
-p -Q -r -R -s
-S -t -u -U -v
-V -w -z
'
types=$(ag --list-file-types |grep -- '--')
# these options require an argument
if [[ "${prev}" == -[ABCGgm] ]] ; then
return 0
fi
_split_longopt && split=true
case "${prev}" in
--ignore-dir) # directory completion
_filedir -d
return 0;;
--path-to-ignore) # file completion
_filedir
return 0;;
--pager) # command completion
COMPREPLY=( $(compgen -c -- "${cur}") )
return 0;;
--ackmate-dir-filter|--after|--before|--color-*|--context|--depth\
|--file-search-regex|--ignore|--max-count|--workers)
return 0;;
esac
$split && return 0
case "${cur}" in
-*)
COMPREPLY=( $(compgen -W \
"${lngopt} ${shtopt} ${types}" -- "${cur}") )
return 0;;
*)
_filedir
return 0;;
esac
} &&
# shellcheck disable=SC2086
# shellcheck disable=SC2154,SC2086
complete -F _ag ${nospace} ag
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。