You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many commands e.g. asdf plugin list will do if ls "$plugins_path"; then for plugin_path in "$plugins_path/*"; do plugin_name=$(basename "$plugin_path") ...
In case $plugins_path doesn't exist, it works as expected.
In case it does exist, but it's empty, "$plugins_path/*" will expand to the literal, and produce $plugin_name='*'
My suggestion would be to check for if [ -n "$(ls -A "$plugins_path" 2>/dev/null)" ]; then ... but I refrained from submitting a PR because I'm a 1h-asdf-newbie, and I can't be certain of your cross-platform requirements e.g. -A is available on BSD and GNU, but it's not POSIX AFAIK. Based on that, other solutions might be more appropriate.
PS: similar if ls ...; then for ... checks and loops appear in the codebase, and they are behave similarly as the instance above, so fixes could/should be applied uniformly across the codebase.
Steps to Reproduce
# install vanilla asdf e.g. `brew install asdf`
asdf plugin add nodejs
asdf plugin remove nodejs
ls -a ${ASDF_DATA_DIR:-${HOME}}/plugins/ # should be empty
Expected Behaviour
No plugins found.
Actual Behaviour
One plugin found '*'.
Environment
OS:
Darwin andrei-macpro15.local 19.6.0 Darwin Kernel Version 19.6.0: Thu May 6 00:48:39 PDT 2021; root:xnu-6153.141.33~1/RELEASE_X86_64 x86_64 i386 MacBookPro10,1 Darwin
SHELL:
zsh 5.8 (x86_64-apple-darwin19.6.0)
ASDF VERSION:
v0.8.1
ASDF ENVIRONMENT VARIABLES:
ASDF_DIR=/usr/local/opt/asdf
ASDF INSTALLED PLUGINS:
*
asdf plugins affected (if relevant)
No response
The text was updated successfully, but these errors were encountered:
I am not a bash expert either but I have submitted a few patches already. The unit tests, the development scripts and specially the Github Actions pipelines make contributing to asdf a piece of cake. I suggest you to give it a try to your solution and if you get all of them green, I am sure it will be a good solution.
Describe the Bug
Many commands e.g.
asdf plugin list
will doif ls "$plugins_path"; then for plugin_path in "$plugins_path/*"; do plugin_name=$(basename "$plugin_path") ...
In case $plugins_path doesn't exist, it works as expected.
In case it does exist, but it's empty,
"$plugins_path/*"
will expand to the literal, and produce$plugin_name='*'
My suggestion would be to check for
if [ -n "$(ls -A "$plugins_path" 2>/dev/null)" ]; then ...
but I refrained from submitting a PR because I'm a 1h-asdf-newbie, and I can't be certain of your cross-platform requirements e.g.-A
is available on BSD and GNU, but it's not POSIX AFAIK. Based on that, other solutions might be more appropriate.PS: similar
if ls ...; then for ...
checks and loops appear in the codebase, and they are behave similarly as the instance above, so fixes could/should be applied uniformly across the codebase.Steps to Reproduce
Expected Behaviour
No plugins found.
Actual Behaviour
One plugin found '*'.
Environment
asdf plugins affected (if relevant)
No response
The text was updated successfully, but these errors were encountered: