asdf-vm/asdf

bug: Command not found: complete on Macos 13.4.1

ducpt1012 opened this issue · 3 comments

Describe the Bug

.asdf/completions/asdf.bash:89: command not found: complete

Steps to Reproduce

cd
git clone https://github.com/excid3/asdf.git ~/.asdf
echo '. "$HOME/.asdf/asdf.sh"' >> ~/.zshrc
echo '. "$HOME/.asdf/completions/asdf.bash"' >> ~/.zshrc
echo 'legacy_version_file = yes' >> ~/.asdfrc
exec $SHELL

Expected Behaviour

It displays this notice
.asdf/completions/asdf.bash:89: command not found: complete

Actual Behaviour

N/A

Environment

OS:
Darwin XXXX-MacBook-Pro.local 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun  8 22:22:22 PDT 2023; root:xnu-8796.121.3~7/RELEASE_X86_64 x86_64

SHELL:
zsh 5.9 (x86_64-apple-darwin22.0)

BASH VERSION:
3.2.57(1)-release

ASDF VERSION:
v0.11.3-2f55f93

ASDF INTERNAL VARIABLES:
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=/Users/xxx/.asdf
ASDF_DIR=/Users/xxx/.asdf
ASDF_CONFIG_FILE=/Users/duc.pt/.asdfrc

ASDF INSTALLED PLUGINS:
nodejs                       https://github.com/asdf-vm/asdf-nodejs.git master 4f8aa3d
ruby                         https://github.com/asdf-vm/asdf-ruby.git master bca6f3b

asdf plugins affected (if relevant)

No response

Are your installation steps from the official documentation?

The echo '. "$HOME/.asdf/completions/asdf.bash"' >> ~/.zshrc command writes a command to a zsh file that sources a Bash-specific completion file. Bash uses the complete builtin for its completion system; Zsh does not have complete which is why you get the error.

To fix this, you can either:

  1. Enable bashcompinit before you source the completion file
  2. (preferred) Append a specific directory to fpath as shown in the getting started guide

I'm install using fish & homebrew it doesn't work at all.
my work around solution is edit this file ~/.vscode/extensions/jakebecker.elixir-ls-0.15.3/elixir-ls-release/launch.sh then change ASDF_DIR=${ASDF_DIR:-"${HOME}/.asdf"} to ASDF_DIR=${ASDF_DIR:-"/opt/homebrew/opt/asdf/libexec"} then restart vscode again

I'm pretty sure if you add ASDF_DIR=${ASDF_DIR:-"/opt/homebrew/opt/asdf/libexec to your shell startup file (or a Fish equivalent command for Fish), and then log out and then log in your computer, the environment variable should be set in in vscode

Related to #1584