curl: fuzzy search options using fzf

08 Feb 2024

Curl has more than 200 CLI options, and using classic autocomplete is not a great way to find those options. So, we will use the fzf, and its custom fuzzy completion API, _fzf_complete to easily find those options.


_fzf_complete_curl() {
  _fzf_complete --header-lines=1  --prompt="curl> " -- "$@" < <(
    curl -h all
  )
}

_fzf_complete_curl_post() {
  awk '{print $1}' | cut -d ',' -f -1
}

Here is the above snippet in action.

asciicast

Versions of Language/packages used in this post.

| Library/Language | Version |
| ---------------- |---------|
| fzf              |  0.45.0 |
If you find my work helpful, You can buy me a coffee.