_npm 529 B

12345678910111213141516171819
  1. #compdef npm
  2. # Node Package Manager 0.3.15 completion, letting npm do all the completion work
  3. _npm() {
  4. compadd -- $(_npm_complete $words)
  5. }
  6. # We want to show all errors of any substance, but never the "npm (not )ok" one.
  7. # (Also doesn't consider "ERR! no match found" worth breaking the terminal for.)
  8. _npm_complete() {
  9. local ask_npm
  10. ask_npm=(npm completion --color false --loglevel error -- $@)
  11. { _call_program npm $ask_npm 2>&1 >&3 \
  12. | egrep -v '^(npm (not |)ok|ERR! no match found)$' >&2; \
  13. } 3>&1
  14. }
  15. _npm "$@"