Skip to content

Commit 86f9134

Browse files
committed
fix(_adb): avoid non-POSIX \? in BRE
POSIX Basic Regular Expressions (BRE) does not support \?. Instead, we can use \{0,1\}. Also, `grep` and `sed` can be combined.
1 parent a3071f3 commit 86f9134

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

completions/_adb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
_comp_cmd_adb__command_usage()
77
{
8-
COMPREPLY=($(compgen -W \
9-
'$("$1" help 2>&1 | command grep "^ *\(adb \)\? *$2 " \
10-
| command sed -e "s/[]|[]/\n/g" | _parse_help -)' -- "$cur"))
8+
COMPREPLY=($(compgen -W '$("$1" help 2>&1 | \
9+
command sed -e "/^ *\(adb \)\{0,1\} *$2 /!d;s/[]|[]/\n/g" | \
10+
_parse_help -)' -- "$cur"))
1111
}
1212

1313
_comp_cmd_adb()

0 commit comments

Comments
 (0)