ohmyzsh: curl completion doesn't offer dash options in macOS

Is your feature request related to a particular plugin or theme? If so, specify it. curl

Is your feature request related to a problem? Please describe. curl command completion plugin has not yet implemented.

Describe the solution you’d like curl tab tab or curl - tab show options of curl command. For now we only have the following options, after issued curl tab tab

curl file:
file:      ftp://     gopher://  http://    https://

Expected

curl
     --anyauth       Pick "any" authentication method (H)
 -a, --append        Append to target file when uploading (F/SFTP)
     --basic         Use HTTP Basic Authentication (H)
     --cacert FILE   CA certificate to verify peer against (SSL)
     --capath DIR    CA directory to verify peer against (SSL)
 -E, --cert CERT[:PASSWD]  Client certificate file and password (SSL)
     --cert-status   Verify the status of the server certificate (SSL)
     --cert-type TYPE  Certificate file type (DER/PEM/ENG) (SSL)
...

Describe alternatives you’ve considered curl -h would show the options.

Additional context Just wanna send my encouragements, respects and supports. Thank you.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 27 (20 by maintainers)

Most upvoted comments

I figured it out:

  • The brew formula curl-openssl doesn’t create the ZSH completion file
  • When using the curl formula, it does get created, but you need to add the path /usr/local/opt/curl/share/zsh/site-functions to the $FPATH: export FPATH="/usr/local/opt/curl/share/zsh/site-functions:$FPATH"
❯ brew info curl                                             
curl: stable 7.72.0 (bottled), HEAD [keg-only]
Get a file from an HTTP, HTTPS or FTP server
https://curl.haxx.se/
/usr/local/Cellar/curl/HEAD-80d73bc (468 files, 3.2MB)
  Built from source on 2020-08-19 at 14:17:54
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/curl.rb
License: curl
==> Dependencies
Build: pkg-config ✔
==> Options
--HEAD
        Install HEAD version
==> Caveats
curl is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.


zsh completions have been installed to:
  /usr/local/opt/curl/share/zsh/site-functions
❯ brew info curl-openssl
curl-openssl: stable 7.72.0 (bottled), HEAD [keg-only]
Get a file from an HTTP, HTTPS or FTP server
https://curl.haxx.se/
/usr/local/Cellar/curl-openssl/HEAD-80d73bc (466 files, 3.3MB)
  Built from source on 2020-08-19 at 14:22:25
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/curl-openssl.rb
License: curl
==> Dependencies
Build: pkg-config ✔
Required: brotli ✔, c-ares ✔, libidn ✔, libmetalink ✔, libssh2 ✔, nghttp2 ✔, openldap ✔, openssl@1.1 ✔, rtmpdump ✔
==> Options
--HEAD
        Install HEAD version
==> Caveats
curl-openssl is keg-only, which means it was not symlinked into /usr/local,
because macOS provides curl.

Thanks again!

The latest curl brew, 8.7.1, does not seem to install zsh completions anymore.

That’s unlikely, which OS?

Should be in /usr/local/opt/curl/share/zsh/site-functions for the Mac (maybe just for homebrew? I don’t use MacOS anymore)

In Ubuntu, it’s located in /usr/share/zsh/vendor-completions/, and 8.7.1 is my version

Could we keep the issue open for now?

So looking at https://github.com/zsh-users/zsh/blob/3d7215cc8277b39cd1e24ce5a04376d45bfbabf0/Completion/Unix/Command/_curl

# As of 7.43.0, curl upstream provides its own _curl definition.  This
# definition is provided as a fallback, and should be installed later
# in $fpath than the curl-provided definition of _curl.

Now my limited knowledge may be at play here, wouldn’t omz be responsible to look at the upstream curl completions?

Maybe this is helpful: https://github.com/curl/curl/blob/9a8b3b3e131359aea1cac650fb6ac331fbe2047c/scripts/completion.pl

It looks like the curl distribution in macOS doesn’t add a _curl file, so there may be an issue with the official Zsh project thinking there’ll be a completion bundled alongside the curl binary.