blob: 151e8a1274b4020dbdbe434dd155ad6bab41bd84 (
plain)
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
|
From eca81ee573f30f8eb790d33db1c86d2970f7fc4a Mon Sep 17 00:00:00 2001
From: Eli Schwartz <eschwartz93@gmail.com>
Date: Sun, 16 Jun 2024 15:35:30 -0400
Subject: [PATCH] bash-completion: port to v2 API
Fixes: #1537
Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
---
ag.bashcomp.sh | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/ag.bashcomp.sh b/ag.bashcomp.sh
index 5637ce4..e03f580 100644
--- a/ag.bashcomp.sh
+++ b/ag.bashcomp.sh
@@ -1,11 +1,9 @@
_ag() {
- local lngopt shtopt split=false
- local cur prev
+ local cur prev words cword split
+ local lngopt shtopt
COMPREPLY=()
- cur=$(_get_cword "=")
- prev="${COMP_WORDS[COMP_CWORD-1]}"
-
+ _init_completion -s || return 0
_expand || return 0
lngopt='
@@ -96,12 +94,10 @@ _ag() {
types=$(ag --list-file-types |grep -- '--')
# these options require an argument
- if [[ "${prev}" == -[ABCGgm] ]] ; then
+ if [[ "${prev}" = -[ABCGgm] ]] ; then
return 0
fi
- _split_longopt && split=true
-
case "${prev}" in
--ignore-dir) # directory completion
_filedir -d
@@ -117,7 +113,9 @@ _ag() {
return 0;;
esac
- $split && return 0
+ if [[ ${split} = true ]]; then
+ return 0
+ fi
case "${cur}" in
-*)
--
2.44.2
|