Skip to content

Commit 677910c

Browse files
committed
feat(strings): fallback to _parse_usage if _parse_help yields nothing
For example on macOS: Usage: strings [-] [-a] [-o] [-t format] [-number] [-n number] [[-arch <arch_flag>] ...] [--] [file ...] While at it, filter -number from the above.
1 parent b4fb473 commit 677910c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

completions/strings

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,14 @@ _strings()
3434
$split && return
3535

3636
if [[ $cur == -* ]]; then
37-
COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur"))
37+
# macOS: ... [-t format] [-number] [-n number] ...
38+
COMPREPLY=($(
39+
compgen -W \
40+
'$(_parse_help "$1" ||
41+
"$1" --help 2>&1 | \
42+
command sed -e "s/\[-number\]//" | _parse_usage -)' \
43+
-- "$cur"
44+
))
3845
[[ ${COMPREPLY-} == *= ]] && compopt -o nospace
3946
return
4047
elif [[ $cur == @* ]]; then

0 commit comments

Comments
 (0)