asdf completion loading non-existent script
I just added asdf to my completions in my .bashrc and it seems like it's attempting to use a script that isn't there.
Relevant part of ~/.bashrc:
completions=(
git
composer
ssh
asdf
)
Sourcing ~/.bashrc after adding this results in:
bash: /opt/homebrew/opt/asdf/libexec/completions/asdf.bash: No such file or directory
From what I can tell, now that script's path is /opt/homebrew/opt/asdf/etc/bash_completion.d/asdf.
I can make a PR if someone can confirm this.
This was added in #593 by @RobLoach based on #310. In the original PR #310, the variable ASDF_DIR seems to be initialized to be $HOME/.asdf, which seems to be consistent with the legacy "Getting Started" document of the official repository. The original PR also seems to have contained the check for the existence of the file. However, in the updated PR #593, the initialization of the variable ASDF_DIR was removed, and even the check for the file's existence seems to have been removed.
On the other hand, the newer official documentation suggests putting . <(asdf completion bash) (However, unfortunately, this doesn't work in Bash 3.2, which Oh My Bash supports).
@RobLoach Could you check these? Could you tell the backgrounds? What would you suggest to solve this?
Some error correction around ASDF_DIR is likely warranted. In my set up I manually set the ASDF_DIR prior to loading the suite of plugins, so it could make sense to check for it before and give it a sane default.
Also, the homebrew stuff is completely untested, as I don't have a Mac. Any fixes you could provide there would be great.
@RobLoach Thanks for your input. I realized that plugins/asdf.plugin.sh contains the necessary ASDF_DIR resolution, but completions/asdf.completion.sh is missing it. Maybe we should think about copying or separating the codes to resolve ASDF_DIR and call it from both plugins/asdf.plugin.sh and completions/asdf.completion.sh.
Ah yes. You will need the asdf plugin in order for the asdf completion to work.
On the other hand, the newer official documentation suggests putting
. <(asdf completion bash)
The bash-completion project (which ASDF completion relies on) has a mechanism to automatically load this kind of configuration, so I submitted a PR to register an entry in bash-completion (https://github.com/scop/bash-completion/pull/1405).