Skip to content

Instantly share code, notes, and snippets.

@fabienhinault
Created July 25, 2019 14:43
Show Gist options
  • Save fabienhinault/dbc13ee82c31541acaff6f32952cc0d9 to your computer and use it in GitHub Desktop.
Save fabienhinault/dbc13ee82c31541acaff6f32952cc0d9 to your computer and use it in GitHub Desktop.
#/usr/bin/env bash
_docurl_completions()
{
IFS=" \t\n"
# COMPREPLY=($(compgen -W "$(history | grep curl | sed "s/\$(\||\|)/\n/g" | grep curl | tail -n 100)" -- "${COMP_WORDS[$COMP_CWORD]}" | sort | uniq ))
COMPREPLY=($(compgen -W "$(history | cut -d ' ' -f2- | grep curl | sed 's/\$(\||\|)/\n/g' | grep curl | tail -n 200 | tr " " "\n" | sort | uniq | cut -c -200 | tr "\n" " ")" -- "${COMP_WORDS[$COMP_CWORD]}"))
}
complete -F _docurl_completions curl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment