-
Notifications
You must be signed in to change notification settings - Fork 0
/
.yarn-npm-complete
36 lines (29 loc) · 913 Bytes
/
.yarn-npm-complete
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#/usr/bin/env bash
common="audit install init publish whoami login"
_yarn_completions()
{
s=$(node -p "Object.keys(require('./package.json').scripts).join(' ')")
if [[ "${COMP_CWORD}" == "1" ]];then
COMPREPLY=($(compgen -W "${s} add ${common} why " ${COMP_WORDS[1]}))
fi
}
complete -F _yarn_completions yarn
_npm_completions()
{
s=$(node -p "Object.keys(require('./package.json').scripts).join(' ')")
if [[ "${COMP_CWORD}" == "1" ]];then
COMPREPLY=($(compgen -W "run ${common}" ${COMP_WORDS[1]}))
fi
if [[ "${COMP_WORDS[1]}" == "run" ]];then
COMPREPLY=($(compgen -W "${s}" ${COMP_WORDS[2]}))
fi
}
complete -F _npm_completions npm
_pnpm_completions()
{
s=$(node -p "Object.keys(require('./package.json').scripts).join(' ')")
if [[ "${COMP_CWORD}" == "1" ]];then
COMPREPLY=($(compgen -W "${s} add ${common} why" ${COMP_WORDS[1]}))
fi
}
complete -F _pnpm_completions pnpm