Skip to content

Commit 3e3621f

Browse files
catullBrocco
authored andcommitted
feature(completion): ng completion made more robust
Fix #2284 Close #2286
1 parent cbee232 commit 3e3621f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Diff for: packages/angular-cli/utilities/completion.sh

+5-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ set_opts='--global -g'
1818
test_opts='--browsers --build --colors --log-level --port --reporters --watch -w'
1919
version_opts='--verbose'
2020

21-
if type complete &>/dev/null; then
21+
if test ".$(type -t complete 2>/dev/null || true)" = ".builtin"; then
2222
_ng_completion() {
2323
local cword pword opts
2424

@@ -47,7 +47,7 @@ if type complete &>/dev/null; then
4747
}
4848

4949
complete -o default -F _ng_completion ng
50-
elif type compctl &>/dev/null; then
50+
elif test ".$(type -w compctl 2>/dev/null || true)" = ".compctl: builtin" ; then
5151
_ng_completion () {
5252
local words cword opts
5353
read -Ac words
@@ -75,6 +75,9 @@ elif type compctl &>/dev/null; then
7575
}
7676

7777
compctl -K _ng_completion ng
78+
else
79+
echo "Shell builtin command 'complete' or 'compctl' is redefined; cannot perform ng completion."
80+
return 1
7881
fi
7982

8083
###-end-ng-completion###

0 commit comments

Comments
 (0)