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