Tab completion for the npx command
Save complete_npx in your home folder and then source it on your .bash_profile with:
. ~/complete_npx| # Based on gibatronic complete_npx | |
| # https://gist.github.com/gibatronic/44073260ffdcbd122e9520756c8e35a1 | |
| complete_npx() { | |
| local CURR_ARG | |
| local FILES=$(find $(npm bin) -perm +111 -type f -or -type l -print0 | xargs -0 basename) | |
| CURR_ARG=${COMP_WORDS[COMP_CWORD]} | |
| COMPREPLY=( $(compgen -W "${FILES[@]}" -- $CURR_ARG ) ); | |
| } | |
| complete -F complete_npx npx |