@@ -7,14 +7,14 @@ _curl()
7
7
8
8
case $prev in
9
9
--ciphers | --connect-timeout | --continue-at | --form | --form-string | \
10
- --ftp-account | --ftp-alternative-to-user | --ftp-port | --header | --help | \
10
+ --ftp-account | --ftp-alternative-to-user | --ftp-port | --header | \
11
11
--hostpubmd5 | --keepalive-time | --krb | --limit-rate | --local-port | \
12
12
--mail-from | --mail-rcpt | --max-filesize | --max-redirs | --max-time | --pass | \
13
13
--proto | --proto-redir | --proxy-user | --proxy1.0 | --quote | --range | \
14
14
--request | --retry | --retry-delay | --retry-max-time | \
15
15
--socks5-gssapi-service | --telnet-option | --tftp-blksize | --time-cond | \
16
16
--url | --user | --user-agent | --version | --write-out | --resolve | --tlsuser | \
17
- --tlspassword | -! (-* )[CFPHhmQrXtzuAVw ])
17
+ --tlspassword | -! (-* )[CFPHmQrXtzuAVw ])
18
18
return
19
19
;;
20
20
--config | --cookie | --cookie-jar | --dump-header | --egd-file | \
@@ -71,6 +71,18 @@ _curl()
71
71
_available_interfaces -a
72
72
return
73
73
;;
74
+ --help | -! (-* )h)
75
+ local x categories=(
76
+ $( " $1 " --help non-existent-category 2>&1 |
77
+ awk ' /^[[:space:]]/ {print $1}' )
78
+ )
79
+ for x in " ${categories[@]} " ; do
80
+ # Looks like an option? Likely no --help category support
81
+ [[ $x != -* ]] || return
82
+ done
83
+ COMPREPLY=($( compgen -W ' ${categories[@]}' -- " $cur " ) )
84
+ return
85
+ ;;
74
86
--proxy | --socks4 | --socks4a | --socks5 | --socks5-hostname | -! (-* )x)
75
87
_known_hosts_real -- " $cur "
76
88
return
@@ -91,7 +103,9 @@ _curl()
91
103
esac
92
104
93
105
if [[ $cur == -* ]]; then
94
- COMPREPLY=($( compgen -W ' $(_parse_help "$1")' -- " $cur " ) )
106
+ COMPREPLY=($( compgen -W ' $(_parse_help "$1" --help all)' -- " $cur " ) )
107
+ [[ $COMPREPLY ]] ||
108
+ COMPREPLY=($( compgen -W ' $(_parse_help "$1")' -- " $cur " ) )
95
109
fi
96
110
} &&
97
111
complete -F _curl curl
0 commit comments