forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcompletion.sh
85 lines (72 loc) · 3.33 KB
/
completion.sh
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
###-begin-ng-completion###
#
# ng command completion script
#
# Installation: ng completion 1>> ~/.bashrc 2>>&1
# or ng completion 1>> ~/.zshrc 2>>&1
#
ng_opts='b build completion doc e2e g generate get github-pages:deploy gh-pages:deploy h help i init install lint make-this-awesome new s serve server set t test v version'
build_opts='--aot --base-href --environment --i18n-file --i18n-format --locale --output-path --progress --sourcemap --suppress-sizes --target --vendor-chunk --verbose --watch --watcher -bh -dev -e -o -prod -sm -t -w'
generate_opts='class component directive enum module pipe route service c cl d e m p r s --help'
github_pages_deploy_opts='--base-href --environment --gh-token --gh-username --message --skip-build --target --user-page --custom-domain -cd -bh -e -t'
help_opts='--json --verbose -v'
init_opts='--dry-run inline-style inline-template --link-cli --name --prefix --routing --skip-npm --source-dir --style --verbose -d -is -it -lc -n -p -sb -sd -sn -v'
new_opts='--directory --dry-run inline-style inline-template --link-cli --prefix --routing --skip-git --skip-npm --source-dir --style --verbose -d -dir -is -it -lc -p -sb -sd -sg -sn -v'
serve_opts='--aot --environment --hmr --host --i18n-file --i18n-format --live-reload --live-reload-base-url --live-reload-host --live-reload-live-css --live-reload-port --locale --open --port --proxy-config --sourcemap --ssl --ssl-cert --ssl-key --target --watcher -H -e -lr -lrbu -lrh -lrp -o -p -pc -sm -t -w'
set_opts='--global -g'
test_opts='--browsers --build --code-coverage --colors --lint --log-level --port --reporters --single-run --sourcemap --watch -cc -l -sm -sr -w'
version_opts='--verbose'
if test ".$(type -t complete 2>/dev/null || true)" = ".builtin"; then
_ng_completion() {
local cword pword opts
COMPREPLY=()
cword=${COMP_WORDS[COMP_CWORD]}
pword=${COMP_WORDS[COMP_CWORD - 1]}
case ${pword} in
ng) opts=$ng_opts ;;
b|build) opts=$build_opts ;;
g|generate) opts=$generate_opts ;;
gh-pages:deploy|github-pages:deploy) opts=$github_pages_deploy_opts ;;
h|help|-h|--help) opts=$help_opts ;;
init) opts=$init_opts ;;
new) opts=$new_opts ;;
s|serve|server) opts=$serve_opts ;;
set) opts=$set_opts ;;
t|test) opts=$test_opts ;;
v|version) opts=$version_opts ;;
*) opts='' ;;
esac
COMPREPLY=( $(compgen -W '${opts}' -- $cword) )
return 0
}
complete -o default -F _ng_completion ng
elif test ".$(type -w compctl 2>/dev/null || true)" = ".compctl: builtin" ; then
_ng_completion () {
local words cword opts
read -Ac words
read -cn cword
let cword-=1
case $words[cword] in
ng) opts=$ng_opts ;;
b|build) opts=$build_opts ;;
g|generate) opts=$generate_opts ;;
gh-pages:deploy|github-pages:deploy) opts=$github_pages_deploy_opts ;;
h|help|-h|--help) opts=$help_opts ;;
init) opts=$init_opts ;;
new) opts=$new_opts ;;
s|serve|server) opts=$serve_opts ;;
set) opts=$set_opts ;;
t|test) opts=$test_opts ;;
v|version) opts=$version_opts ;;
*) opts='' ;;
esac
setopt shwordsplit
reply=($opts)
unset shwordsplit
}
compctl -K _ng_completion ng
else
echo "Shell builtin command 'complete' or 'compctl' is redefined; cannot perform ng completion."
return 1
fi
###-end-ng-completion###