Closed
Description
Please provide us with the following information:
- OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
All OSes, seen in under macOS 10.11 (El Cap) and 10.12 (Sierra). - Versions. Please run
ng --version
. If there's nothing outputted, please run
angular-cli: 1.0.0-beta.15
node: 6.6.0
os: darwin x64 - Repro steps.
Configure your login shell to be /bin/zsh or /usr/local/bin/zsh if you can.
Let's say it is installed in the folder /opt/opam.
Execute this:
. /opt/opam/opam-init/init.zsh
rehash
which complete
this gives you
complete () {
emulate -L zsh
local args void cmd print remove
args=("$@")
zparseopts -D -a void o: A: G: W: C: F: P: S: X: a b c d e f g j k u v p=print r=remove
if [[ -n $print ]]
then
printf 'complete %2$s %1$s\n' "${(@kv)_comps[(R)_bash*]#* }"
elif [[ -n $remove ]]
then
for cmd
do
unset "_comps[$cmd]"
done
else
compdef _bash_complete\ ${(j. .)${(q)args[1,-1-$#]}} "$@"
fi
}
ng complete
detects the shell with the criteria
if type complete &>/dev/null; then
...
elif type compctl &>/dev/null; then
...
fi
It appears that either complete
or compctl
may be shadowed in a BASH or ZSH session by third party software.
In the case of OPAM installed and initialised in a shell, complete
is defined as a function, thus it currently leads ng complete
to produce completion logic for BASH.
A better approach is to detect the real type of complete
/compctl
and only carry on if they are builtin functions.
The builtin function type
's options (BASH: -t, ZSH: -w) are our assistants.
Here's a solution which works both in BASH and ZSH, with and without OPAM installed:
if test ".$(type -t complete 2>/dev/null || true)" = ".builtin"; then
...
elif test ".$(type -w compctl 2>/dev/null || true)" = ".compctl: builtin" ; then
...
fi
- The log given by the failure. Normally this include a stack trace and some more information.
- Mention any other details that might be useful.
The modification mentioned in 3. works and is more robust.
Thanks! We'll be in touch soon.