changeset 992 | d9cb7673d29c |
991:57fda390e91c | 992:d9cb7673d29c |
---|---|
1 # -*- mode: sh; sh-shell-file: bash -*- |
|
2 |
|
3 _npx() { |
|
4 local dir=$(pwd -P) |
|
5 while [[ -n "$dir" ]]; do |
|
6 if [[ ! -d $dir/node_modules/.bin ]]; then |
|
7 dir=${dir%/*} |
|
8 continue |
|
9 fi |
|
10 local execs=( `cd $dir/node_modules/.bin; find -L . -type f -executable` ) |
|
11 execs=( ${execs[@]/#.\//} ) |
|
12 local cur=${COMP_WORDS[COMP_CWORD]} |
|
13 COMPREPLY=( $(compgen -W "${execs[*]}" -- "$cur" ) ) |
|
14 break |
|
15 done |
|
16 } |
|
17 |
|
18 complete -F _npx npx |